The Multithreaded Portable Runtime (MPR) is a portable runtime library for embedded applications.
The MPR provides management for logging, error handling, events, files, http, memory, ssl, sockets, strings, xml parsing, and date/time functions. It also provides a foundation of safe routines for secure programming, that help to prevent buffer overflows and other security threats. The MPR is a library and a C API that can be used in both C and C++ programs.
The MPR uses a set extended typedefs for common types. These include: bool, cchar, cvoid, uchar, short, ushort, int, uint, long, ulong, int32, uint32, int64, uint64, float, and double. The cchar type is a const char, cvoid is const void. Several types have "u" prefixes to denote unsigned qualifiers.
The MPR includes a memory allocator and generational garbage collector. The allocator is a fast, immediate coalescing allocator that will return memory back to the O/S if not required. It is optimized for frequent allocations of small blocks (< 4K) and uses a scheme of free queues for fast allocation.
The MPR provides a high-performance thread-pool to share threads as required to service clients. When a client request arrives, the MPR allocates an event queue called a dispatcher. This dispatcher then serializes all activity for the request so that it essentially runs single-threaded This simplifies the code as most interactions do not need to be lock protected. When a request has activity, it borrows a thread from the thread pool, does its work and then returns the thread to the thread pool. This all happens very quickly, so a small pool of threads are effectivelyshared over many requests. Thread are free to block if required, but typically non-blocking patterns are more economical. If you have non-MPR threads that need to call into the MPR, you must synchronize such calls via mprCreateEventOutside.
| Mpr | Primary MPR application control structure. |
| MprBuf | Dynamic Buffer Module. |
| MprCache | In-memory caching. |
| MprCmd | Command execution Service. |
| MprDispatcher | Event Dispatcher. |
| MprEvent | Event object. |
| MprFile | File I/O Module. |
| MprFileSystem | File system service. |
| MprFloat | Floating Point Services. |
| MprHash | Hash table entry structure. |
| MprJson | JSON Object. |
| MprList | List data structure. |
| MprLog | Logging Services. |
| MprMem | Memory Allocation Service. |
| MprMime | Mime Type hash table entry (the URL extension is the key). |
| MprModule | Loadable Module Service. |
| MprModuleSerivce | Loadable module service. |
| MprPath | Path (filename) Information. |
| MprSignal | Signal control structure. |
| MprSocket | Socket Service. |
| MprSsl | SSL control structure. |
| MprString | Safe String Module. |
| MprSync | Multithreaded Synchronization Services. |
| MprTestService | Test service facility. |
| MprThread | Thread Service. |
| MprTime | Date and Time Service. |
| MprWaitHandler | Wait Handler Service. |
| MprWorker | Worker thread structure. |
| MprXml | Per XML session structure. |
| void | assert(bool cond) |
| Assert that a condition is true. | |
| bool | assertTrue(MprTestGroup *gp, cchar *loc, bool success, cchar *msg) |
| Test assert. | |
| char* | fmt(char *buf, ssize maxSize, cchar *fmt, ...) |
| Format a string into a static buffer. | |
| char* | fmtv(char *buf, ssize maxSize, cchar *fmt, va_list args) |
| Format a string into a statically allocated buffer. | |
| char* | itos(int64 value) |
| Convert an integer to a string. | |
| char* | itosbuf(char *buf, ssize size, int64 value, int radix) |
| Convert an integer to a string buffer. | |
| char* | itosradix(int64 value, int radix) |
| Convert an integer to a string. | |
| MprSocket* | mprAcceptSocket(MprSocket *listen) |
| Accept an incoming connection. | |
| MprKey* | mprAddDuplicateKey(MprHash *table, cvoid *key, cvoid *ptr) |
| Add a duplicate symbol value into the hash table. | |
| void | mprAddFileSystem(MprFileSystem *fs) |
| Create and initialize the disk FileSystem. | |
| int | mprAddItem(MprList *list, cvoid *item) |
| Add an item to a list. | |
| MprKey* | mprAddKey(MprHash *table, cvoid *key, cvoid *ptr) |
| Add a symbol value into the hash table. | |
| MprKey* | mprAddKeyFmt(MprHash *table, cvoid *key, cchar *fmt, ...) |
| Add a key with a formatting value into the hash table. | |
| MprKey* | mprAddKeyWithType(MprHash *table, cvoid *key, cvoid *ptr, int type) |
| Add a symbol value into the hash table and set the key type. | |
| MprMime* | mprAddMime(MprHash *table, cchar *ext, cchar *mimeType) |
| Add a mime type to the mime type table. | |
| int | mprAddNullItem(MprList *list) |
| Add a null item to the list. | |
| void | mprAddNullToBuf(MprBuf *buf) |
| Add a null character to the buffer contents. | |
| void | mprAddRoot(cvoid *ptr) |
| Add a memory block as a root for garbage collection. | |
| MprSignal* | mprAddSignalHandler(int signo, void *handler, void *arg, MprDispatcher *dispatcher, int flags) |
| Add a signal handler. | |
| MprWaitHandler* | mprAddSocketHandler(MprSocket *sp, int mask, MprDispatcher *dispatcher, void *proc, void *data, int flags) |
| Add a wait handler to a socket. | |
| void | mprAddSocketProvider(cchar *name, MprSocketProvider *provider) |
| Add a secure socket provider for SSL communications. | |
| void | mprAddSslCiphers(struct MprSsl *ssl, cchar *ciphers) |
| Add the ciphers to use for SSL. | |
| void | mprAddStandardSignals() |
| Add standard trapping of system signals. | |
| void | mprAddTerminator(MprTerminator terminator) |
| Add a service terminator. | |
| MprTestGroup* | mprAddTestGroup(MprTestService *ts, MprTestDef *def) |
| Add a test group to the test service. | |
| void | mprAdjustBufEnd(MprBuf *buf, ssize count) |
| Adjust the buffer end position. | |
| void | mprAdjustBufStart(MprBuf *buf, ssize count) |
| Adjust the buffer start position. | |
| void* | mprAlloc(size_t size) |
| Allocate a block of memory. | |
| void* | mprAllocMem(size_t size, int flags) |
| Allocate a block of memory. | |
| void* | mprAllocObj(Type type, MprManager manager) |
| Allocate an object of a given type. | |
| void* | mprAllocZeroed(size_t size) |
| Allocate a zeroed block of memory. | |
| MprList* | mprAppendList(MprList *list, MprList *add) |
| Append a list. | |
| bool | mprAreCmdEventsEnabled(MprCmd *cmd, int channel) |
| Return true if command events are enabled. | |
| void | mprAssert(cchar *loc, cchar *msg) |
| Output an assure assertion failed message. | |
| void | mprAtomicAdd(volatile int *target, int value) |
| Atomic Add. | |
| void | mprAtomicAdd64(volatile int64 *target, int64 value) |
| Atomic 64 bit Add. | |
| void | mprAtomicBarrier() |
| Apply a full (read+write) memory barrier. | |
| int | mprAtomicCas(void *volatile *target, void *expected, cvoid *value) |
| Atomic Compare and Swap. | |
| void | mprAtomicListInsert(void **head, void **link, void *item) |
| Atomic list insertion. | |
| void | mprAtomicOpen() |
| Open and initialize the atomic subystem. | |
| MprFile* | mprAttachFileFd(int fd, cchar *name, int omode) |
| Attach to an existing file descriptor. | |
| int | mprAvailableWorkers() |
| Get the count of available worker threads Return the count of free threads in the worker thread pool. | |
| int | mprBackupLog(cchar *path, int count) |
| Backup a log. | |
| MprHash* | mprBlendHash(MprHash *target, MprHash *other) |
| Blend two hash tables. | |
| int | mprBlendJson(MprJson *dest, MprJson *other, int flags) |
| Blend two JSON objects. | |
| void | mprBreakpoint() |
| Trigger a breakpoint. | |
| char* | mprBufToString(MprBuf *buf) |
| Convert the buffer contents to a string. | |
| bool | mprCancelShutdown() |
| Cancel a shutdown request. | |
| bool | mprCheckPassword(cchar *plainTextPassword, cchar *passwordHash) |
| Check a plain-text password against the defined hashed password. | |
| void | mprClearList(MprList *list) |
| Clears the list of all items. | |
| void | mprClearWaiting() |
| Clear the event service waiting flag. | |
| MprBuf* | mprCloneBuf(MprBuf *orig) |
| Clone a buffer. | |
| char* | mprCloneBufAsString(MprBuf *bp) |
| Clone a buffer contents. | |
| char* | mprCloneBufMem(MprBuf *bp) |
| Clone a buffer contents. | |
| MprHash* | mprCloneHash(MprHash *table) |
| Copy a hash table. | |
| MprJson* | mprCloneJson(MprJson *obj) |
| Clone a JSON object. | |
| MprList* | mprCloneList(MprList *src) |
| Clone a list and all elements. | |
| MprSocket* | mprCloneSocket(MprSocket *sp) |
| Clone a socket object. | |
| struct MprSsl* | mprCloneSsl(MprSsl *src) |
| Create the a new SSL control structure based on an existing structure. | |
| void | mprCloseCmdFd(MprCmd *cmd, int channel) |
| Close the command channel. | |
| int | mprCloseFile(MprFile *file) |
| Close a file. | |
| void | mprCloseSocket(MprSocket *sp, bool graceful) |
| Close a socket. | |
| void | mprCompactBuf(MprBuf *buf) |
| Compact the buffer contents. | |
| int | mprCompareTime(MprTime t1, MprTime t2) |
| Compare two times. | |
| int | mprConnectSocket(MprSocket *sp, cchar *ip, int port, int flags) |
| Connect a client socket. | |
| int | mprCopyListContents(MprList *dest, MprList *src) |
| Copy list contents. | |
| int | mprCopyPath(cchar *from, cchar *to, int omode) |
| Copy a file. | |
| Mpr* | mprCreate(int argc, char **argv, int flags) |
| Initialize the application by creating an instance of the MPR. | |
| MprBuf* | mprCreateBuf(ssize initialSize, ssize maxSize) |
| Create a new buffer. | |
| MprCache* | mprCreateCache(int options) |
| Create a new cache object. | |
| int | mprCreateCacheService() |
| Initialize the cache service on startup. | |
| MprCmd* | mprCreateCmd(MprDispatcher *dispatcher) |
| Create a new Command object. | |
| MprCond* | mprCreateCond() |
| Create a condition lock variable. | |
| MprDispatcher* | mprCreateDispatcher(cchar *name, int flags) |
| Create a new event dispatcher. | |
| MprEvent* | mprCreateEvent(MprDispatcher *dispatcher, cchar *name, MprTicks period, void *proc, void *data, int flags) |
| Create a new event. | |
| int | mprCreateEventOutside(MprDispatcher *dispatcher, cchar *name, void *proc, void *data, int flags) |
| Create an event from outside the MPR. | |
| MprFileSystem* | mprCreateFileSystem(cchar *path) |
| Create and initialize the FileSystem subsystem. | |
| MprHash* | mprCreateHash(int hashSize, int flags) |
| Create a hash table. | |
| MprHash* | mprCreateHashFromWords(cchar *str) |
| Create a hash of words. | |
| MprJson* | mprCreateJson(int type) |
| Create a JSON object. | |
| MprKeyValue* | mprCreateKeyPair(cchar *key, cchar *value, int flags) |
| Create a key / value pair. | |
| MprList* | mprCreateList(int size, int flags) |
| Create a list. | |
| MprList* | mprCreateListFromWords(cchar *str) |
| Create a list of words. | |
| MprMutex* | mprCreateLock() |
| Create a Mutex lock object. | |
| void | mprCreateLogService() |
| Initialize the log service. | |
| struct Mpr* | mprCreateMemService(MprManager manager, int flags) |
| Create and initialize the Memory service. | |
| MprHash* | mprCreateMimeTypes(cchar *path) |
| Create the mime types. | |
| MprModule* | mprCreateModule(cchar *name, cchar *path, cchar *entry, void *data) |
| Create a module. | |
| MprModuleService* | mprCreateModuleService() |
| Create and initialize the module service. | |
| int | mprCreateNotifierService(MprWaitService *ws) |
| Internal. | |
| int | mprCreateOsService() |
| Create and initialze the O/S dependent subsystem. | |
| MprRomFileSystem* | mprCreateRomFileSystem(cchar *path) |
| Create and initialize the ROM FileSystem. | |
| MprSocket* | mprCreateSocket() |
| Create a socket. | |
| MprSpin* | mprCreateSpinLock() |
| Create a spin lock lock object. | |
| struct MprSsl* | mprCreateSsl(int server) |
| Create the SSL control structure. | |
| MprTestService* | mprCreateTestService() |
| Create the test service. | |
| MprThread* | mprCreateThread(cchar *name, void *proc, void *data, ssize stackSize) |
| Create a new thread. | |
| int | mprCreateTimeService() |
| Mpr time structure. | |
| MprEvent* | mprCreateTimerEvent(MprDispatcher *dispatcher, cchar *name, MprTicks period, void *proc, void *data, int flags) |
| Create a timer event. | |
| MprWaitHandler* | mprCreateWaitHandler(int fd, int mask, MprDispatcher *dispatcher, void *proc, void *data, int flags) |
| Create a wait handler. | |
| char* | mprCryptPassword(cchar *password, cchar *salt, int rounds) |
| Encrypt a password using the Blowfish algorithm. | |
| int | mprDaemon() |
| Convert the process into a daemon on unix systems. | |
| char* | mprDecode64(cchar *str) |
| Decode a null terminated string using base-46 encoding. | |
| char* | mprDecode64Block(cchar *buf, ssize *len, int flags) |
| Decode a null terminated string using base-46 encoding. | |
| void | mprDecodeLocalTime(struct tm *timep, MprTime time) |
| Decode a time value into a tokenized local time value. | |
| void | mprDecodeUniversalTime(struct tm *timep, MprTime time) |
| Decode a time value into a tokenized UTC time structure. | |
| void | mprDedicateWorker(MprWorker *worker) |
| Dedicate a worker thread to a current real thread. | |
| int | mprDeletePath(cchar *path) |
| Delete a file. | |
| MprHash* | mprDeserialize(cchar *str) |
| Deserialize a simple JSON string and return a hash of properties. | |
| MprHash* | mprDeserializeInto(cchar *str, MprHash *hash) |
| Deserialize a simple JSON string into the given hash object. | |
| bool | mprDestroy() |
| Destroy the MPR and all services using the MPR. | |
| void* | mprDestroyCache(MprCache *cache) |
| Destroy a new cache object. | |
| void | mprDestroyCmd(MprCmd *cmd) |
| Destroy the command. | |
| void | mprDestroyDispatcher(MprDispatcher *dispatcher) |
| Disable a dispatcher from service events. | |
| void | mprDestroyWaitHandler(MprWaitHandler *wp) |
| Destroy a wait handler. | |
| void | mprDisableCmdEvents(MprCmd *cmd, int channel) |
| Disable command I/O events. | |
| void | mprDisableFileBuffering(MprFile *file) |
| Disable file buffering. | |
| void | mprDisconnectCmd(MprCmd *cmd) |
| Disconnect a command its underlying I/O channels. | |
| void | mprDisconnectSocket(MprSocket *sp) |
| Disconnect a socket by closing its underlying file descriptor. | |
| char* | mprEmptyString() |
| Reference to a permanent preallocated empty string. | |
| void | mprEnableCmdEvents(MprCmd *cmd, int channel) |
| Enable command I/O events. | |
| void | mprEnableCmdOutputEvents(MprCmd *cmd, bool on) |
| Enable command I/O events for the command's STDOUT and STDERR channels. | |
| void | mprEnableContinuousEvent(MprEvent *event, int enable) |
| Enable or disable an event being continous. | |
| int | mprEnableFileBuffering(MprFile *file, ssize size, ssize maxSize) |
| Enable file buffering. | |
| bool | mprEnableGC(bool on) |
| Enable or disable the garbage collector. | |
| void | mprEnableSocketEvents(MprSocket *sp, int mask) |
| Enable socket events for a socket callback. | |
| char* | mprEncode64(cchar *str) |
| Encode a string using base-46 encoding. | |
| char* | mprEncode64Block(cchar *buf, ssize len) |
| Encode buffer using base-46 encoding. | |
| ssize | mprEprintf(cchar *fmt, ...) |
| Print a formatted message to the standard error channel. | |
| void | mprError(cchar *fmt, ...) |
| Log an error message. | |
| char* | mprEscapeCmd(cchar *cmd, int escChar) |
| Encode a string escaping typical command (shell) characters. | |
| char* | mprEscapeHtml(cchar *html) |
| Encode a string by escaping typical HTML characters. | |
| char* | mprEscapeSQL(cchar *cmd) |
| Encode a string by escaping SQL special characters. | |
| int | mprExpireCacheItem(MprCache *cache, cchar *key, MprTicks expires) |
| Set the expiry date for a cache item. | |
| void | mprFatal(cchar *fmt, ...) |
| Log a fatal error message and exit. | |
| void | mprFinalizeCmd(MprCmd *cmd) |
| Finalize the writing of data to the command process. | |
| void | mprFlushBuf(MprBuf *buf) |
| Flush the buffer contents. | |
| int | mprFlushFile(MprFile *file) |
| Flush any buffered write data. | |
| ssize | mprFlushSocket(MprSocket *sp) |
| Flush a socket. | |
| char* | mprFormatLocalTime(cchar *fmt, MprTime time) |
| Convert a time value to local time and format as a string. | |
| char* | mprFormatTm(cchar *fmt, struct tm *timep) |
| Format a time value as a local time. | |
| char* | mprFormatUniversalTime(cchar *fmt, MprTime time) |
| Convert a time value to universal time and format as a string. | |
| ssize | mprFprintf(struct MprFile *file, cchar *fmt, ...) |
| Print a formatted message to a file descriptor. | |
| int | mprGC(int flags) |
| Collect garbage. | |
| bool | mprGCPaused() |
| Test if GC has been paused. | |
| char* | mprGetAbsPath(cchar *path) |
| Convert a path to an absolute path. | |
| ssize | mprGetActiveCmdCount() |
| Get the count of active commands. | |
| char* | mprGetAppDir() |
| Get the application directory. | |
| cchar* | mprGetAppName() |
| Get the application name defined via mprSetAppName. | |
| char* | mprGetAppPath() |
| Get the application executable path. | |
| cchar* | mprGetAppTitle() |
| Get the application title string. | |
| cchar* | mprGetAppVersion() |
| Get the application version string. | |
| ssize | mprGetBlockFromBuf(MprBuf *buf, char *blk, ssize count) |
| Get a block of data from the buffer. | |
| size_t | mprGetBlockSize(cvoid *ptr) |
| Get the allocated size of a memory block. | |
| char* | mprGetBuf(MprBuf *buf) |
| Get the origin of the buffer content storage. | |
| char* | mprGetBufEnd(MprBuf *buf) |
| Get a reference to the end of the buffer contents. | |
| ssize | mprGetBufLength(MprBuf *buf) |
| Get the buffer content length. | |
| MprBufProc | mprGetBufRefillProc(MprBuf *buf) |
| Get the buffer refill procedure. | |
| ssize | mprGetBufSize(MprBuf *buf) |
| Get the current size of the buffer content storage. | |
| ssize | mprGetBufSpace(MprBuf *buf) |
| Get the space available to store content. | |
| char* | mprGetBufStart(MprBuf *buf) |
| Get the start of the buffer contents. | |
| ssize | mprGetBusyWorkerCount() |
| Get the count of workers in the busy queue. | |
| void | mprGetCacheStats(MprCache *cache, int *numKeys, ssize *mem) |
| Get the Cache statistics. | |
| int | mprGetCharFromBuf(MprBuf *buf) |
| Get a character from the buffer. | |
| MprBuf* | mprGetCmdBuf(MprCmd *cmd, int channel) |
| Get the underlying buffer for a channel. | |
| int | mprGetCmdExitStatus(MprCmd *cmd) |
| Get the command exit status. | |
| int | mprGetCmdFd(MprCmd *cmd, int channel) |
| Get the underlying file descriptor for an I/O channel. | |
| bool | mprGetCmdlineLogging() |
| Get if command line logging is being used. | |
| MprOsThread | mprGetCurrentOsThread() |
| Get the O/S thread. | |
| char* | mprGetCurrentPath() |
| Return the current working directory. | |
| MprThread* | mprGetCurrentThread() |
| Get the currently executing thread. | |
| cchar* | mprGetCurrentThreadName() |
| Return the name of the current thread. | |
| MprWorker* | mprGetCurrentWorker() |
| Get the worker object if the current thread is actually a worker thread. | |
| char* | mprGetDate(char *fmt) |
| Get a string representation of the current date/time. | |
| bool | mprGetDebugMode() |
| Get the debug mode. | |
| MprDispatcher* | mprGetDispatcher() |
| Get the MPR primary dispatcher. | |
| cchar* | mprGetDomainName() |
| Get the application domain name string. | |
| MprTicks | mprGetElapsedTicks(MprTicks mark) |
| Get the elapsed time since a ticks mark. | |
| MprTime | mprGetElapsedTime(MprTime mark) |
| Get the elapsed time since a starting time mark. | |
| int | mprGetEndian() |
| Return the endian byte ordering for the application. | |
| int | mprGetError() |
| Return the error code for the most recent system or library operation. | |
| int | mprGetExitStatus() |
| Get the exit status. | |
| int | mprGetFileChar(MprFile *file) |
| Read a character from the file. | |
| int | mprGetFileFd(MprFile *file) |
| Get the file descriptor for a file. | |
| MprOff | mprGetFilePosition(MprFile *file) |
| Return the current file position. | |
| MprOff | mprGetFileSize(MprFile *file) |
| Get the size of the file. | |
| void* | mprGetFirstItem(MprList *list) |
| Get the first item in the list. | |
| MprKey* | mprGetFirstKey(MprHash *table) |
| Return the first symbol in a symbol entry. | |
| cchar* | mprGetFirstPathSeparator(cchar *path) |
| Get the first path separator in a path. | |
| int | mprGetHashLength(MprHash *table) |
| Return the count of symbols in a symbol entry. | |
| uint64 | mprGetHiResTicks() |
| Get the CPU tick count. | |
| cchar* | mprGetHostName() |
| Get the application host name string. | |
| cchar* | mprGetIpAddr() |
| Get the application IP address string. | |
| void* | mprGetItem(MprList *list, int index) |
| Get an list item. | |
| cchar* | mprGetJson(MprJson *obj, cchar *key, int flags) |
| Lookup a JSON object tree for a string key value. | |
| ssize | mprGetJsonLength(MprJson *obj) |
| Get the number of child properties in a JSON object. | |
| MprJson* | mprGetJsonObj(MprJson *obj, cchar *key, int flags) |
| Lookup a parsed JSON object for a key value. | |
| void* | mprGetLastItem(MprList *list) |
| Get the last item in the list. | |
| int | mprGetListCapacity(MprList *list) |
| Get the current capacity of the list. | |
| int | mprGetListLength(MprList *list) |
| Get the number of items in the list. | |
| struct MprFile* | mprGetLogFile() |
| Get the log file object. | |
| MprLogHandler | mprGetLogHandler() |
| Get the current MPR debug log handler. | |
| int | mprGetLogLevel() |
| Get the current logging level. | |
| char* | mprGetMD5(cchar *str) |
| Get an MD5 checksum. | |
| char* | mprGetMD5WithPrefix(cchar *buf, ssize len, cchar *prefix) |
| Get an MD5 checksum with optional prefix string and buffer length. | |
| int | mprGetMaxWorkers() |
| Get the maximum count of worker pool threads Get the maximum limit of worker pool threads. | |
| size_t | mprGetMem() |
| Return the amount of memory currently used by the application. | |
| MprMemStats* | mprGetMemStats() |
| Return the current allocation memory statistics block. | |
| cchar* | mprGetMimeProgram(MprHash *table, cchar *mimeType) |
| Get the mime type program for a given mimeType. | |
| cchar* | mprGetModuleSearchPath() |
| Get the module search path. | |
| Mpr* | mprGetMpr() |
| Return the MPR control instance. | |
| char* | mprGetNativePath(cchar *path) |
| Get a path formatted according to the native O/S conventions. | |
| void* | mprGetNextItem(MprList *list, int *lastIndex) |
| Get the next item in the list. | |
| MprKey* | mprGetNextKey(MprHash *table, MprKey *last) |
| Return the next symbol in a symbol entry. | |
| void* | mprGetNextStableItem(MprList *list, int *lastIndex) |
| Get the next item in a stable list. | |
| int | mprGetOsError() |
| Return the O/S error code. | |
| int | mprGetPageSize() |
| Get the current O/S virtual page size. | |
| char* | mprGetPassword(cchar *prompt) |
| Get a password from the terminal console. | |
| char* | mprGetPathBase(cchar *path) |
| Get the base portion of a path. | |
| cchar* | mprGetPathBaseRef(cchar *path) |
| Get a reference to the base portion of a path. | |
| char* | mprGetPathDir(cchar *path) |
| Get the directory portion of a path. | |
| char* | mprGetPathExt(cchar *path) |
| Get the file extension portion of a path. | |
| MprList* | mprGetPathFiles(cchar *dir, int flags) |
| Create a list of files in a directory or subdirectories. | |
| char* | mprGetPathFirstDir(cchar *path) |
| Get the first directory portion of a path. | |
| int | mprGetPathInfo(cchar *path, MprPath *info) |
| Return information about a file represented by a path. | |
| char* | mprGetPathLink(cchar *path) |
| Get the target of a symbolic link. | |
| cchar* | mprGetPathNewline(cchar *path) |
| Get the file newline character string for a given path. | |
| char* | mprGetPathParent(cchar *path) |
| Get the parent directory of a path. | |
| char | mprGetPathSeparator(cchar *path) |
| Get the default path directory separator. | |
| cchar* | mprGetPathSeparators(cchar *path) |
| Get the path directory separator. | |
| char* | mprGetPortablePath(cchar *path) |
| Get a portable path. | |
| void* | mprGetPrevItem(MprList *list, int *lastIndex) |
| Get the previous item in the list. | |
| int | mprGetRandomBytes(char *buf, ssize size, bool block) |
| Get some random data. | |
| char* | mprGetRandomString(ssize size) |
| Get some random data in ascii. | |
| char* | mprGetRelPath(cchar *dest, cchar *origin) |
| Get a relative path. | |
| MprTicks | mprGetRemainingTicks(MprTicks mark, MprTicks timeout) |
| Return the time remaining until a timeout has elapsed. | |
| char* | mprGetSHA(cchar *str) |
| Get an SHA1 checksum. | |
| char* | mprGetSHABase64(cchar *str) |
| Get an SHA1 checksum of a null terminated string. | |
| char* | mprGetSHAWithPrefix(cchar *buf, ssize len, cchar *prefix) |
| Get an SHA1 checksum with optional prefix string and buffer length. | |
| cchar* | mprGetServerName() |
| Get the application server name string. | |
| bool | mprGetSocketBlockingMode(MprSocket *sp) |
| Get the socket blocking mode. | |
| int | mprGetSocketError(MprSocket *sp) |
| Get a socket error code. | |
| Socket | mprGetSocketHandle(MprSocket *sp) |
| Get the socket file descriptor. | |
| int | mprGetSocketInfo(cchar *ip, int port, int *family, int *protocol, struct sockaddr **addr, Socklen *addrlen) |
| Get the socket for an IP:Port address. | |
| int | mprGetSocketPort(MprSocket *sp) |
| Get the port used by a socket. | |
| char* | mprGetSocketState(MprSocket *sp) |
| Get the socket state. | |
| int | mprGetSslCipherCode(cchar *cipher) |
| Lookup an SSL cipher by its IANA name and return the cipher IANA code. | |
| cchar* | mprGetSslCipherName(int cipher) |
| Lookup an SSL cipher by its IANA code and return the string name. | |
| int | mprGetState() |
| Get the MPR execution state. | |
| MprFile* | mprGetStderr() |
| Return a file object for the Stderr I/O channel. | |
| MprFile* | mprGetStdin() |
| Return a file object for the Stdin I/O channel. | |
| MprFile* | mprGetStdout() |
| Return a file object for the Stdout I/O channel. | |
| char* | mprGetTempPath(cchar *tmpDir) |
| Make a temporary file. | |
| cchar* | mprGetThreadName(MprThread *thread) |
| Get the thread name. | |
| int | mprGetThreadPriority(MprThread *thread) |
| Get the thread priroity. | |
| MprTicks | mprGetTicks() |
| Get the system time. | |
| MprTime | mprGetTime() |
| Get the time. | |
| int | mprGetTimeZoneOffset(MprTime when) |
| Get the current timezone offset for a given time. | |
| char* | mprGetWinPath(cchar *path) |
| Convert a path to an absolute windows path. | |
| void | mprGetWorkerStats(MprWorkerStats *stats) |
| Get the Worker service statistics. | |
| MprList* | mprGlobPathFiles(cchar *path, cchar *patterns, int flags) |
| Create a list of files in a directory or subdirectories that match the given wildcard patterns. | |
| void | mprGlobalLock() |
| Globally lock the application. | |
| void | mprGlobalUnlock() |
| Unlock the global mutex. | |
| int | mprGrowBuf(MprBuf *buf, ssize count) |
| Grow the buffer. | |
| bool | mprHasDualNetworkStack() |
| has the system got a dual IPv4 + IPv6 network stack. | |
| bool | mprHasIPv6() |
| Determine if the system support IPv6. | |
| bool | mprHasMemError() |
| Determine if the MPR has encountered memory allocation errors. | |
| bool | mprHasSecureSockets() |
| Determine if SSL is available. | |
| char* | mprHashKeysToString(MprHash *hash, cchar *join) |
| Convert hash keys to a single string. | |
| MprJson* | mprHashToJson(MprHash *hash) |
| Convert a hash object into a JSON object. | |
| char* | mprHashToString(MprHash *hash, cchar *join) |
| Convert a hash of strings to a single string. | |
| void | mprHiddenSocketData(MprSocket *sp, ssize len, int dir) |
| Indicate that the application layer has buffered data for the socket. | |
| void | mprHold(cvoid *ptr) |
| Hold a memory block. | |
| void | mprHoldBlocks(cvoid *ptr, ...) |
| Hold memory blocks. | |
| int64 | mprIncCache(MprCache *cache, cchar *key, int64 amount) |
| Increment a numeric cache item. | |
| void | mprInfo(cchar *fmt, ...) |
| Log an informational message. | |
| void | mprInitList(MprList *list, int flags) |
| Initialize a list structure. | |
| MprMutex* | mprInitLock(MprMutex *mutex) |
| Initialize a statically allocated Mutex lock object. | |
| MprSpin* | mprInitSpinLock(MprSpin *lock) |
| Initialize a statically allocated spinlock object. | |
| int | mprInsertCharToBuf(MprBuf *buf, int c) |
| Insert a character into the buffer. | |
| int | mprInsertItemAtPos(MprList *list, int index, cvoid *item) |
| Insert an item into a list at a specific position. | |
| bool | mprIsAbsPathContained(cchar *path, cchar *dir) |
| Fast version of mprIsPathContained that works only for absolute paths. | |
| int | mprIsCmdComplete(MprCmd *cmd) |
| Test if a command is complete. | |
| bool | mprIsCmdRunning(MprCmd *cmd) |
| Test if the command is still running. | |
| bool | mprIsDestroyed() |
| Determine if the MPR has finished. | |
| bool | mprIsDestroying() |
| Test if the application is terminating and core services are being destroyed All request should immediately terminate. | |
| bool | mprIsIPv6(cchar *ip) |
| Determine if the IP address is an IPv6 address. | |
| bool | mprIsIdle(bool traceRequests) |
| Determine if the App is idle. | |
| int | mprIsInfinite(double value) |
| Test if a double value is infinte. | |
| int | mprIsNan(double value) |
| Test if a double value is not-a-number. | |
| bool | mprIsPathAbs(cchar *path) |
| Determine if a path is absolute. | |
| bool | mprIsPathContained(cchar *path, cchar *dir) |
| Determine if a directory is the same as or a parent of a path. | |
| bool | mprIsPathDir(cchar *path) |
| Determine if a path is a directory. | |
| bool | mprIsPathRel(cchar *path) |
| Determine if a path is relative. | |
| bool | mprIsPathSeparator(cchar *path, cchar c) |
| Test if a character is a path separarator. | |
| bool | mprIsSocketEof(MprSocket *sp) |
| Test if the other end of the socket has been closed. | |
| bool | mprIsSocketSecure(MprSocket *sp) |
| Determine if the socket is secure. | |
| bool | mprIsSocketV6(MprSocket *sp) |
| Determine if the socket is using IPv6 Currently only works for server side addresses. | |
| bool | mprIsStopped() |
| Test if the application is stopped If this routine returns true, the application shutdown has passed the point of no return. | |
| bool | mprIsStopping() |
| Test if the application is stopping If mprIsStopping is true, the application has commenced a shutdown. | |
| int | mprIsValid(cvoid *ptr) |
| Test is a pointer is a valid memory context. | |
| int | mprIsZero(double value) |
| Test if a double value is zero. | |
| char* | mprJoinPath(cchar *base, cchar *path) |
| Join paths. | |
| char* | mprJoinPathExt(cchar *path, cchar *ext) |
| Join an extension to a path. | |
| char* | mprJoinPaths(cchar *base, ...) |
| Join paths. | |
| MprJson* | mprJsonQuery(MprJson *obj, cchar *keyPath, MprJson *value, int flags) |
| Query a JSON object for a property key path and execute the given command. | |
| MprHash* | mprJsonToHash(MprJson *json) |
| Convert a JSON object into a Hash object. | |
| char* | mprJsonToString(MprJson *obj, int flags) |
| Serialize a JSON object into a string. | |
| char* | mprListToString(MprList *list, cchar *join) |
| Convert a list of strings to a single string. | |
| Socket | mprListenOnSocket(MprSocket *sp, cchar *ip, int port, int flags) |
| Listen on a server socket for incoming connections. | |
| MprJson* | mprLoadJson(cchar *path) |
| Load a JSON object from a filename. | |
| int | mprLoadModule(MprModule *mp) |
| Load a module. | |
| int | mprLoadNativeModule(MprModule *mp) |
| Load a native module. | |
| int | mprLoadSsl() |
| Load the SSL module. | |
| void | mprLock(MprMutex *lock) |
| Lock access. | |
| void | mprLog(int level, cchar *fmt, ...) |
| Write a message to the log file. | |
| void | mprLogHeader() |
| Emit a descriptive log header. | |
| int | mprLookAtLastCharInBuf(MprBuf *buf) |
| Peek at the last character in the buffer. | |
| int | mprLookAtNextCharInBuf(MprBuf *buf) |
| Peek at the next character in the buffer. | |
| char* | mprLookupCache(MprCache *cache, cchar *key, MprTime *modified, int64 *version) |
| Lookup an item in the cache. | |
| MprFileSystem* | mprLookupFileSystem(cchar *path) |
| Lookup a file system. | |
| int | mprLookupItem(MprList *list, cvoid *item) |
| Find an item and return its index. | |
| cchar* | mprLookupJson(MprJson *obj, cchar *name) |
| Lookup a JSON object. | |
| MprJson* | mprLookupJsonObj(MprJson *obj, cchar *name) |
| Lookup a JSON object. | |
| void* | mprLookupKey(MprHash *table, cvoid *key) |
| Lookup a symbol in the hash table. | |
| MprKey* | mprLookupKeyEntry(MprHash *table, cvoid *key) |
| Lookup a symbol in the hash table and return the hash entry. | |
| cchar* | mprLookupMime(MprHash *table, cchar *ext) |
| Get the mime type for an extension. | |
| MprModule* | mprLookupModule(cchar *name) |
| Lookup a module. | |
| void* | mprLookupModuleData(cchar *name) |
| Lookup a module and return the module data. | |
| int | mprLookupStringItem(MprList *list, cchar *str) |
| Find a string item and return its index. | |
| int | mprMakeArgv(cchar *command, cchar ***argv, int flags) |
| Make a argv style array of command arguments. | |
| int | mprMakeDir(cchar *path, int perms, int owner, int group, bool makeMissing) |
| Make a directory. | |
| int | mprMakeLink(cchar *path, cchar *target, bool hard) |
| Make a link. | |
| char* | mprMakePassword(cchar *password, int saltLength, int rounds) |
| Make a password hash for a plain-text password using the Blowfish algorithm. | |
| char* | mprMakeSalt(ssize size) |
| Make salt for adding to a password. | |
| void | mprMapSeparators(char *path, int separator) |
| Map the separators in a path. | |
| void | mprMark(void *ptr) |
| Mark a memory block as in-use. | |
| int | mprMemcmp(cvoid *b1, size_t b1Len, cvoid *b2, size_t b2Len) |
| Compare two byte strings. | |
| size_t | mprMemcpy(void *dest, size_t destMax, cvoid *src, size_t nbytes) |
| Safe copy for a block of data. | |
| void* | mprMemdup(cvoid *ptr, size_t size) |
| Duplicate a block of memory. | |
| void | mprNap(MprTicks msec) |
| Nap for a while. | |
| bool | mprNeedYield() |
| Test if a thread should call mprYield. | |
| char* | mprNormalizePath(cchar *path) |
| Normalize a path. | |
| int | mprNotifyOn(MprWaitHandler *wp, int mask) |
| Begin I/O notification services on a wait handler. | |
| MprFile* | mprOpenFile(cchar *filename, int omode, int perms) |
| Open a file. | |
| int | mprParseArgs(char *command, char **argv, int maxArgs) |
| Make a argv style array of command arguments. | |
| MprJson* | mprParseJson(cchar *str) |
| Parse a JSON string into an object tree. | |
| MprJson* | mprParseJsonEx(cchar *str, MprJsonCallback *callback, void *data, MprJson *obj, cchar **errorMsg) |
| Extended JSON parsing from a JSON string into an object tree. | |
| MprJson* | mprParseJsonInto(cchar *str, MprJson *obj) |
| Parse a JSON string into an existing object. | |
| int | mprParseSocketAddress(cchar *address, char **ip, int *port, int *secure, int defaultPort) |
| Parse an socket address IP address. | |
| int | mprParseTestArgs(MprTestService *ts, int argc, char **argv, MprTestParser extraParser) |
| Parse test command arguments. | |
| bool | mprPathExists(cchar *path, int omode) |
| Determine if a file exists for a path name and can be accessed. | |
| bool | mprPauseGC() |
| Pause the garbage collector. | |
| int | mprPeekFileChar(MprFile *file) |
| Non-destructively read a character from the file. | |
| void | mprPollWinCmd(MprCmd *cmd, MprTicks timeout) |
| Poll for I/O on the command pipes. | |
| void* | mprPopItem(MprList *list) |
| Pop an item. | |
| void | mprPrintMem(cchar *msg, int flags) |
| Print a memory usage report to stdout. | |
| ssize | mprPrintf(cchar *fmt, ...) |
| Formatted print. | |
| char* | mprPrintfCore(char *buf, ssize maxsize, cchar *fmt, va_list args) |
| Format a string into a buffer. | |
| void | mprPruneCache(MprCache *cache) |
| Prune the cache. | |
| int | mprPushItem(MprList *list, cvoid *item) |
| Push an item onto the list. | |
| ssize | mprPutBlockToBuf(MprBuf *buf, cchar *ptr, ssize size) |
| Put a block to the buffer. | |
| int | mprPutCharToBuf(MprBuf *buf, int c) |
| Put a character to the buffer. | |
| ssize | mprPutFileChar(MprFile *file, int c) |
| Write a character to the file. | |
| ssize | mprPutFileString(MprFile *file, cchar *str) |
| Write a string to the file. | |
| ssize | mprPutIntToBuf(MprBuf *buf, int64 i) |
| Put an integer to the buffer. | |
| ssize | mprPutPadToBuf(MprBuf *buf, int c, ssize count) |
| Put padding characters to the buffer. | |
| ssize | mprPutStringToBuf(MprBuf *buf, cchar *str) |
| Put a string to the buffer. | |
| ssize | mprPutSubStringToBuf(MprBuf *buf, cchar *str, ssize count) |
| Put a substring to the buffer. | |
| ssize | mprPutToBuf(MprBuf *buf, cchar *fmt, ...) |
| Put a formatted string to the buffer. | |
| MprJson* | mprQueryJson(MprJson *obj, cchar *key, int flags) |
| Query a parsed JSON object for a key value. | |
| void | mprQueueIOEvent(MprWaitHandler *wp) |
| Queue an IO event for dispatch on the wait handler dispatcher. | |
| int | mprRandom() |
| Return a random number. | |
| void | mprRawLog(int level, cchar *fmt, ...) |
| Write a raw log message to the diagnostic log file. | |
| char* | mprReadCache(MprCache *cache, cchar *key, MprTime *modified, int64 *version) |
| Read an item from the cache. | |
| ssize | mprReadCmd(MprCmd *cmd, int channel, char *buf, ssize bufsize) |
| Make the I/O channels to send and receive data to and from the command. | |
| ssize | mprReadFile(MprFile *file, void *buf, ssize size) |
| Read data from a file. | |
| char* | mprReadLine(MprFile *file, ssize size, ssize *len) |
| Read a line from the file. | |
| ssize | mprReadSocket(MprSocket *sp, void *buf, ssize size) |
| Read from a socket. | |
| void* | mprRealloc(void *ptr, size_t size) |
| Reallocate a block. | |
| int | mprReapCmd(MprCmd *cmd, MprTicks timeout) |
| Reap the command. | |
| void | mprRecallWaitHandler(MprWaitHandler *wp) |
| Recall a wait handler. | |
| void | mprRecallWaitHandlerByFd(Socket fd) |
| Recall a wait handler by fd. | |
| int | mprRefillBuf(MprBuf *buf) |
| Refill the buffer with data. | |
| void | mprRelayEvent(MprDispatcher *dispatcher, void *proc, void *data, MprEvent *event) |
| Relay an event to a dispatcher. | |
| void | mprRelease(cvoid *ptr) |
| Release a memory block. | |
| void | mprReleaseBlocks(cvoid *ptr, ...) |
| Release a memory blocks. | |
| void | mprReleaseWorker(MprWorker *worker) |
| Release a worker thread. | |
| bool | mprRemoveCache(MprCache *cache, cchar *key) |
| Remove items from the cache. | |
| void | mprRemoveEvent(MprEvent *event) |
| Remove an event. | |
| int | mprRemoveItem(MprList *list, cvoid *item) |
| Remove an item from the list. | |
| int | mprRemoveItemAtPos(MprList *list, int index) |
| Remove an item from the list. | |
| MprJson* | mprRemoveJson(MprJson *obj, cchar *key) |
| Remove a property from a JSON object. | |
| void | mprRemoveJsonChild(MprJson *obj, MprJson *child) |
| Remove a child from a JSON object. | |
| int | mprRemoveKey(MprHash *table, cvoid *key) |
| Remove a symbol entry from the hash table. | |
| int | mprRemoveLastItem(MprList *list) |
| Remove the last item from the list. | |
| int | mprRemoveRangeOfItems(MprList *list, int start, int end) |
| Remove a range of items from the list. | |
| void | mprRemoveRoot(cvoid *ptr) |
| Remove a memory block as a root for garbage collection. | |
| void | mprRemoveSocketHandler(MprSocket *sp) |
| Remove a socket wait handler. | |
| int | mprRemoveStringItem(MprList *list, cchar *str) |
| Remove a string item from the list. | |
| void | mprRemoveWaitHandler(MprWaitHandler *wp) |
| Remove a wait handler from the wait service. | |
| char* | mprReplacePathExt(cchar *dir, cchar *ext) |
| Replace an extension to a path. | |
| void | mprReportTestResults(MprTestService *ts) |
| Report the test results. | |
| void | mprRescheduleEvent(MprEvent *event, MprTicks period) |
| Reschedule an event. | |
| void | mprResetBufIfEmpty(MprBuf *buf) |
| Reset the buffer. | |
| void | mprResetCond(MprCond *cond) |
| Reset a condition variable. | |
| void | mprResetMemError() |
| Reset the memory allocation error flag. | |
| void | mprResetTestGroup(MprTestGroup *gp) |
| Reset a test group. | |
| void | mprResetYield() |
| Reset a sticky yield. | |
| char* | mprResolvePath(cchar *base, cchar *path) |
| Resolve paths. | |
| void | mprRestart() |
| Restart the application. | |
| void | mprRestartContinuousEvent(MprEvent *event) |
| Restart an event. | |
| void | mprResumeGC() |
| Resume the garbage collector. | |
| int | mprRun(MprDispatcher *dispatcher, cchar *command, cchar *input, char **output, char **error, MprTicks timeout) |
| Run a simple blocking command using a string command line. | |
| int | mprRunCmd(MprCmd *cmd, cchar *command, cchar **envp, cchar *in, char **out, char **err, MprTicks timeout, int flags) |
| Run a command using a string command line. | |
| int | mprRunCmdV(MprCmd *cmd, int argc, cchar **argv, cchar **envp, cchar *in, char **out, char **err, MprTicks timeout, int flags) |
| Run a command using an argv[] array of arguments. | |
| int | mprRunTests(MprTestService *ts) |
| Run the define unit tests. | |
| int | mprSamePath(cchar *path1, cchar *path2) |
| Compare two paths if they are the same. | |
| int | mprSamePathCount(cchar *path1, cchar *path2, ssize len) |
| Compare two paths if they are the same for a given length. | |
| int | mprSaveJson(MprJson *obj, cchar *path, int flags) |
| Save a JSON object to a filename. | |
| char* | mprSearchForModule(cchar *module) |
| Search for a module on the current module path. | |
| char* | mprSearchPath(cchar *path, int flags, cchar *search, ...) |
| Search for a path. | |
| MprOff | mprSeekFile(MprFile *file, int seekType, MprOff distance) |
| Seek the I/O pointer to a new location in the file. | |
| char* | mprSerialize(MprHash *hash, int flags) |
| Serialize a hash of properties as a JSON string. | |
| int | mprServiceEvents(MprTicks delay, int flags) |
| Service events. | |
| bool | mprServicesAreIdle(bool traceRequests) |
| Determine if the MPR services. | |
| int | mprSetAppName(cchar *name, cchar *title, cchar *version) |
| Set the application name, title and version. | |
| void | mprSetAppPath(cchar *path) |
| Set the application executable path. | |
| void | mprSetBufMax(MprBuf *buf, ssize maxSize) |
| Set the maximum buffer size. | |
| void | mprSetBufRefillProc(MprBuf *buf, MprBufProc fn, void *arg) |
| Set the buffer refill procedure. | |
| int | mprSetBufSize(MprBuf *buf, ssize size, ssize maxSize) |
| Set the buffer size. | |
| void | mprSetCacheLimits(MprCache *cache, int64 keys, MprTicks lifespan, int64 memory, int resolution) |
| Set the cache resource limits. | |
| int | mprSetCacheLink(MprCache *cache, cchar *key, void *link) |
| Set a linked managed memory reference for a cached item. | |
| void | mprSetCacheNotify(MprCache *cache, MprCacheProc notify) |
| Set a notification callback to be invoked for events of interest on cached items. | |
| void | mprSetCmdCallback(MprCmd *cmd, MprCmdProc callback, void *data) |
| Define a callback to be invoked to receive response data from the command. | |
| void | mprSetCmdDefaultEnv(MprCmd *cmd, cchar **env) |
| Set the default environment to use for commands. | |
| void | mprSetCmdDir(MprCmd *cmd, cchar *dir) |
| Set the home directory for the command. | |
| void | mprSetCmdEnv(MprCmd *cmd, cchar **env) |
| Set the command environment. | |
| void | mprSetCmdSearchPath(MprCmd *cmd, cchar *search) |
| Set the default command search path. | |
| bool | mprSetCmdlineLogging(bool on) |
| Set if command line logging was requested. | |
| void | mprSetCurrentThreadPriority(int priority) |
| Set the thread priroity for the current thread. | |
| void | mprSetDebugMode(bool on) |
| Turn on debug mode. | |
| void | mprSetDomainName(cchar *s) |
| Set the application domain name string. | |
| void | mprSetEnv(cchar *key, cchar *value) |
| Set an environment variable value. | |
| void | mprSetEventServiceSleep(MprTicks delay) |
| Set the maximum sleep time for the event service. | |
| void | mprSetExitStatus(int status) |
| Set the proposed exit status. | |
| void | mprSetExitTimeout(MprTicks timeout) |
| Set the exit timeout for a shutdown. | |
| void | mprSetFilesLimit(int limit) |
| Set the maximum number of open file/socket descriptors. | |
| void | mprSetHostName(cchar *s) |
| Set the application host name string. | |
| MprIdleCallback | mprSetIdleCallback(MprIdleCallback idleCallback) |
| Define a new idle callback to be invoked by mprIsIdle() | |
| void | mprSetIpAddr(cchar *ip) |
| Sete the application IP address string. | |
| void* | mprSetItem(MprList *list, int index, cvoid *item) |
| Set a list item. | |
| int | mprSetJson(MprJson *obj, cchar *key, cchar *value, int flags) |
| Update a key/value in the JSON object with a string value. | |
| void | mprSetJsonError(MprJsonParser *jp, cchar *fmt, ...) |
| Signal a parse error in the JSON input stream. | |
| int | mprSetJsonObj(MprJson *obj, cchar *key, MprJson *value, int flags) |
| Update a property in a JSON object. | |
| int | mprSetListLimits(MprList *list, int initialSize, int maxSize) |
| Define the list size limits. | |
| void | mprSetLogBackup(ssize logSize, int backupCount, int flags) |
| Set the log rotation parameters. | |
| void | mprSetLogFile(struct MprFile *file) |
| Set a file to be used for logging. | |
| void | mprSetLogHandler(MprLogHandler handler) |
| Set an MPR debug log handler. | |
| void | mprSetLogLevel(int level) |
| Set the current logging level. | |
| void* | mprSetManager(void *ptr, MprManager manager) |
| Update the manager for a block of memory. | |
| int | mprSetMaxSocketAccept(int max) |
| Set the maximum number of accepted client connections that are permissable. | |
| void | mprSetMaxWorkers(int count) |
| Set the maximum count of worker threads Set the maximum number of worker pool threads for the MPR. | |
| void | mprSetMemError() |
| Set an memory allocation error condition on a memory context. | |
| void | mprSetMemLimits(ssize warnHeap, ssize maximum, ssize cache) |
| Configure the application memory limits. | |
| void | mprSetMemNotifier(MprMemNotifier cback) |
| Define a memory notifier. | |
| void | mprSetMemPolicy(int policy) |
| Set the memory allocation policy for when allocations fail. | |
| int | mprSetMimeProgram(MprHash *table, cchar *mimeType, cchar *program) |
| Set the mime type program. | |
| void | mprSetMinWorkers(int count) |
| Set the minimum count of worker threads Set the count of threads the worker pool will have. | |
| void | mprSetModuleFinalizer(MprModule *module, MprModuleProc stop) |
| Define a module finalizer that will be called before a module is stopped. | |
| void | mprSetModuleSearchPath(char *searchPath) |
| Set the module search path. | |
| void | mprSetModuleTimeout(MprModule *module, MprTicks timeout) |
| Set a module timeout. | |
| void | mprSetOsError(int error) |
| Set the O/S error code. | |
| void | mprSetPathNewline(cchar *path, cchar *newline) |
| Set the file system new line character string. | |
| void | mprSetPathSeparators(cchar *path, cchar *separators) |
| Set the file system path separators. | |
| int | mprSetRomFileSystem(MprRomInode *inodeList) |
| Set the ROM file system data. | |
| void | mprSetServerName(cchar *s) |
| Set the application server name string. | |
| int | mprSetSocketBlockingMode(MprSocket *sp, bool on) |
| Set the socket blocking mode. | |
| void | mprSetSocketDispatcher(MprSocket *sp, MprDispatcher *dispatcher) |
| Set the dispatcher to use for socket events. | |
| void | mprSetSocketEof(MprSocket *sp, bool eof) |
| Set an EOF condition on the socket. | |
| int | mprSetSocketNoDelay(MprSocket *sp, bool on) |
| Set the socket delay mode. | |
| void | mprSetSslCaFile(struct MprSsl *ssl, cchar *caFile) |
| Set the client certificate file to use for SSL. | |
| void | mprSetSslCaPath(struct MprSsl *ssl, cchar *caPath) |
| Set the path for the client certificate directory. | |
| void | mprSetSslCertFile(struct MprSsl *ssl, cchar *certFile) |
| Set certificate to use for SSL. | |
| void | mprSetSslCiphers(MprSsl *ssl, cchar *ciphers) |
| Set the ciphers to use. | |
| void | mprSetSslKeyFile(struct MprSsl *ssl, cchar *keyFile) |
| Set the key file to use for SSL. | |
| void | mprSetSslProtocols(struct MprSsl *ssl, int protocols) |
| Set the SSL protocol to use. | |
| void | mprSetSslProvider(MprSsl *ssl, cchar *provider) |
| Set the SSL provider to use. | |
| void | mprSetThreadPriority(MprThread *thread, int priority) |
| Set the thread priroity. | |
| void | mprSetWorkerStackSize(int size) |
| Set the default worker stack size. | |
| bool | mprShouldAbortRequests() |
| Test if requests should be aborted. | |
| bool | mprShouldDenyNewRequests() |
| Test if new requests should be denied. | |
| void | mprShutdown(int exitStrategy, int status, MprTicks timeout) |
| Initiate shutdown of the MPR and application. | |
| void | mprSignalCond(MprCond *cond) |
| Signal a condition lock variable. | |
| void | mprSignalDispatcher(MprDispatcher *dispatcher) |
| Signal the dispatcher to wakeup and re-examine its queues. | |
| void | mprSignalMultiCond(MprCond *cond) |
| Signal a condition lock variable for use with multiple waiters. | |
| void | mprSignalTest2Complete(MprTestGroup *gp) |
| Signal a test is complete. | |
| void | mprSignalTestComplete(MprTestGroup *gp) |
| Signal a test is complete. | |
| void | mprSleep(MprTicks msec) |
| Sleep for a while. | |
| bool | mprSocketHandshaking(MprSocket *sp) |
| Test if the socket is doing an SSL handshake. | |
| bool | mprSocketHasBufferedRead(MprSocket *sp) |
| Test if the socket has buffered read data. | |
| bool | mprSocketHasBufferedWrite(MprSocket *sp) |
| Test if the socket has buffered write data. | |
| void | mprSort(void *base, ssize num, ssize width, MprSortProc compare, void *ctx) |
| Quicksort. | |
| MprList* | mprSortList(MprList *list, MprSortProc compare, void *ctx) |
| Sort a list. | |
| void | mprSpinLock(MprSpin *lock) |
| Lock a spinlock. | |
| void | mprSpinUnlock(MprSpin *lock) |
| Unlock a spinlock. | |
| int | mprStart() |
| Start the Mpr services. | |
| int | mprStartCmd(MprCmd *cmd, int argc, cchar **argv, cchar **envp, int flags) |
| Start the command. | |
| int | mprStartEventsThread() |
| Start an thread dedicated to servicing events. | |
| int | mprStartLogging(cchar *logSpec, int showConfig) |
| Start logging. | |
| int | mprStartModule(MprModule *mp) |
| Start a module. | |
| int | mprStartModuleService() |
| Start the module service. | |
| int | mprStartOsService() |
| Start the O/S dependent subsystem. | |
| int | mprStartThread(MprThread *thread) |
| Start a thread. | |
| int | mprStartWorker(MprWorkerProc proc, void *data) |
| Start a worker thread. | |
| Socket | mprStealSocketHandle(MprSocket *sp) |
| Steal the socket handle. | |
| int | mprStopCmd(MprCmd *cmd, int signal) |
| Stop the command. | |
| void | mprStopContinuousEvent(MprEvent *event) |
| Stop an event. | |
| int | mprStopModule(MprModule *mp) |
| Stop a module. | |
| void | mprStopModuleService() |
| Stop the module service. | |
| void | mprStopOsService() |
| Stop the O/S dependent subsystem. | |
| void | mprTrace(int level, cchar *fmt, ...) |
| Write a trace message to the diagnostic log file. | |
| void | mprTraceJson(int level, MprJson *obj) |
| Trace the JSON object to the debug log. | |
| char* | mprTransformPath(cchar *path, int flags) |
| Transform a path. | |
| char* | mprTrimPathComponents(cchar *path, int count) |
| Trim path components from a path. | |
| char* | mprTrimPathDrive(cchar *path) |
| Trim the drive from a path. | |
| char* | mprTrimPathExt(cchar *path) |
| Trim an extension from a path. | |
| int | mprTruncateFile(cchar *path, MprOff size) |
| Truncate a file. | |
| bool | mprTryLock(MprMutex *lock) |
| Attempt to lock access. | |
| bool | mprTrySpinLock(MprSpin *lock) |
| Attempt to lock access on a spin lock. | |
| int | mprUnloadModule(MprModule *mp) |
| Unload a module. | |
| int | mprUnloadNativeModule(MprModule *mp) |
| Unload a native module. | |
| void | mprUnlock(MprMutex *lock) |
| Unlock a mutex. | |
| int | mprUpgradeSocket(MprSocket *sp, struct MprSsl *ssl, cchar *peerName) |
| Upgrade a socket to use SSL/TLS. | |
| char* | mprUriDecode(cchar *uri) |
| Decode a URI string by de-scaping URI characters. | |
| char* | mprUriDecodeInSitu(char *uri) |
| Decode a URI string by de-scaping URI characters. | |
| char* | mprUriEncode(cchar *uri, int map) |
| Encode a string by escaping URI characters. | |
| int | mprUsingDefaultLogHandler() |
| Determine if the app is using the default MPR log handler. | |
| void | mprVerifySslDepth(struct MprSsl *ssl, int depth) |
| Control the depth of SSL SSL certificate verification. | |
| void | mprVerifySslIssuer(struct MprSsl *ssl, bool on) |
| Control the verification of SSL certificate issuers. | |
| void | mprVerifySslPeer(struct MprSsl *ssl, bool on) |
| Require verification of peer certificates. | |
| void* | mprVirtAlloc(size_t size, int mode) |
| Memory virtual memory into the applications address space. | |
| void | mprVirtFree(void *ptr, size_t size) |
| Free (unpin) a mapped section of virtual memory. | |
| int | mprWaitForCmd(MprCmd *cmd, MprTicks timeout) |
| Wait for the command to complete. | |
| int | mprWaitForCond(MprCond *cond, MprTicks timeout) |
| Wait for a condition lock variable. | |
| int | mprWaitForEvent(MprDispatcher *dispatcher, MprTicks timeout) |
| Wait for an event to occur on the given dispatcher. | |
| void | mprWaitForIO(MprWaitService *ws, MprTicks timeout) |
| Wait for I/O. | |
| int | mprWaitForMultiCond(MprCond *cond, MprTicks timeout) |
| Wait for a condition lock variable for use with multiple waiters. | |
| int | mprWaitForSingleIO(int fd, int mask, MprTicks timeout) |
| Wait for I/O on a file descriptor. | |
| bool | mprWaitForTest2ToComplete(MprTestGroup *gp, MprTicks timeout) |
| Wait for a test to complete. | |
| bool | mprWaitForTestToComplete(MprTestGroup *gp, MprTicks timeout) |
| Wait for a test to complete. | |
| void | mprWaitOn(MprWaitHandler *wp, int desiredMask) |
| Subscribe for desired wait events. | |
| void | mprWakeEventService() |
| Wake the event service. | |
| void | mprWarn(cchar *fmt, ...) |
| Log a warning message. | |
| ssize | mprWriteCache(MprCache *cache, cchar *key, cchar *value, MprTime modified, MprTicks lifespan, int64 version, int options) |
| Write a cache item. | |
| ssize | mprWriteCmd(MprCmd *cmd, int channel, cchar *buf, ssize bufsize) |
| Write data to an I/O channel. | |
| ssize | mprWriteCmdBlock(MprCmd *cmd, int channel, cchar *buf, ssize bufsize) |
| Write data to an I/O channel. | |
| ssize | mprWriteFile(MprFile *file, cvoid *buf, ssize count) |
| Write data to a file. | |
| ssize | mprWriteFileFmt(MprFile *file, cchar *fmt, ...) |
| Write formatted data to a file. | |
| ssize | mprWriteFileString(MprFile *file, cchar *str) |
| Write a string to a file. | |
| ssize | mprWritePathContents(cchar *path, cchar *buf, ssize len, int mode) |
| Create a file and write contents. | |
| ssize | mprWriteSocket(MprSocket *sp, cvoid *buf, ssize len) |
| Write to a socket. | |
| ssize | mprWriteSocketString(MprSocket *sp, cchar *str) |
| Write to a string to a socket. | |
| ssize | mprWriteSocketVector(MprSocket *sp, MprIOVec *iovec, int count) |
| Write a vector to a socket. | |
| cchar* | mprXmlGetErrorMsg(MprXml *xp) |
| Get the XML error message if mprXmlParse fails. | |
| int | mprXmlGetLineNumber(MprXml *xp) |
| Get the source XML line number. | |
| void* | mprXmlGetParseArg(MprXml *xp) |
| Get the XML callback argument. | |
| MprXml* | mprXmlOpen(ssize initialSize, ssize maxSize) |
| Open an XML parser instance. | |
| int | mprXmlParse(MprXml *xp) |
| Run the XML parser. | |
| void | mprXmlSetInputStream(MprXml *xp, MprXmlInputStream fn, void *arg) |
| Define the XML parser input stream. | |
| void | mprXmlSetParseArg(MprXml *xp, void *parseArg) |
| Set the XML callback argument. | |
| void | mprXmlSetParserHandler(MprXml *xp, MprXmlHandler h) |
| Set the XML parser data handle. | |
| void | mprYield(int flags) |
| Signify to the garbage collector that the thread is ready for garbage collection. | |
| void* | palloc(size_t size) |
| Allocate a "permanent" block of memory that is not subject GC. | |
| void | pfree(void *ptr) |
| Free a "permanent" block of memory allocated via "palloc". | |
| void* | prealloc(void *ptr, size_t size) |
| Reallocate a "permanent" block of memory allocated via "palloc". | |
| ssize | print(cchar *fmt, ...) |
| Print to stdout and add a trailing newline. | |
| size_t | psize(void *ptr) |
| Return the size of the block. | |
| char* | scamel(cchar *str) |
| Create a camel case version of the string. | |
| int | scaselesscmp(cchar *s1, cchar *s2) |
| Compare strings ignoring case. | |
| bool | scaselessmatch(cchar *s1, cchar *s2) |
| Compare strings ignoring case. | |
| char* | schr(cchar *str, int c) |
| Find a character in a string. | |
| char* | sclone(cchar *str) |
| Clone a string. | |
| int | scmp(cchar *s1, cchar *s2) |
| Compare strings. | |
| char* | scontains(cchar *str, cchar *pattern) |
| Find a pattern in a string. | |
| ssize | scopy(char *dest, ssize destMax, cchar *src) |
| Copy a string. | |
| bool | sends(cchar *str, cchar *suffix) |
| Test if the string ends with a given pattern. | |
| char* | sfmt(cchar *fmt, ...) |
| Format a string. | |
| char* | sfmtv(cchar *fmt, va_list args) |
| Format a string. | |
| uint | shash(cchar *str, ssize len) |
| Compute a hash code for a string. | |
| uint | shashlower(cchar *str, ssize len) |
| Compute a caseless hash code for a string. | |
| char* | sjoin(cchar *str, ...) |
| Catenate strings. | |
| char* | sjoinv(cchar *str, va_list args) |
| Catenate strings. | |
| ssize | slen(cchar *str) |
| Return the length of a string. | |
| char* | slower(cchar *str) |
| Convert a string to lower case. | |
| bool | smatch(cchar *s1, cchar *s2) |
| Compare strings. | |
| int | sncaselesscmp(cchar *s1, cchar *s2, ssize len) |
| Compare strings ignoring case. | |
| char* | snclone(cchar *str, ssize len) |
| Clone a substring. | |
| int | sncmp(cchar *s1, cchar *s2, ssize len) |
| Compare strings. | |
| char* | sncontains(cchar *str, cchar *pattern, ssize limit) |
| Find a pattern in a string with a limit. | |
| ssize | sncopy(char *dest, ssize destMax, cchar *src, ssize len) |
| Copy characters from a string. | |
| char* | spbrk(cchar *str, cchar *set) |
| Locate the a character in a string. | |
| char* | srchr(cchar *str, int c) |
| Find a character in a string by searching backwards. | |
| char* | srejoin(char *buf, ...) |
| Append strings to an existing string and reallocate as required. | |
| char* | srejoinv(char *buf, va_list args) |
| Append strings to an existing string and reallocate as required. | |
| ssize | sspn(cchar *str, cchar *set) |
| Find the end of a spanning prefix. | |
| bool | sstarts(cchar *str, cchar *prefix) |
| Test if the string starts with a given pattern. | |
| char* | ssub(cchar *str, ssize offset, ssize length) |
| Create a substring. | |
| char* | stemplate(cchar *str, struct MprHash *tokens) |
| Replace template tokens in a string with values from a lookup table. | |
| char* | stemplateJson(cchar *str, struct MprJson *tokens) |
| Replace template tokens in a string with values from a lookup table. | |
| char* | stitle(cchar *str) |
| Create a Title Case version of the string. | |
| double | stof(cchar *str) |
| Convert a string to a double. | |
| int64 | stoi(cchar *str) |
| Convert a string to an integer. | |
| int64 | stoiradix(cchar *str, int radix, int *err) |
| Convert a string to an integer. | |
| char* | stok(char *str, cchar *delim, char **last) |
| Tokenize a string. | |
| struct MprList* | stolist(cchar *src) |
| String to list. | |
| char* | strim(cchar *str, cchar *set, int where) |
| Trim a string. | |
| char* | supper(cchar *str) |
| Convert a string to upper case. |
| MprBufProc | Buffer refill callback function. |
| MprCacheProc | Cache item expiry callback. |
| MprCmdChild | Child status structure. |
| MprCmdService | Command execution service. |
| MprCond | Condition variable for single and multi-thread synchronization. |
| MprDirEntry | Directory entry description. |
| MprEventProc | Event callback function. |
| MprForkCallback | Callback function before doing a fork(). |
| MprFreeMem | Block structure when on a free list. |
| MprFreeQueue | Free queue head structure. |
| MprHash | Hash table control structure. |
| MprHashProc | Hashing function to use for the table. |
| MprHeap | Memory allocator heap. |
| MprIOVec | Vectored write array. |
| MprJsonCallback | JSON parsing callbacks. |
| MprJsonParser | JSON parser. |
| MprKeyValue | Key value pairs for use with MprList or MprKey. |
| MprListCompareProc | List comparison procedure for sorting. |
| MprLogHandler | Log handler callback type. |
| MprManager | Mpr memory block manager prototype. |
| MprMemNotifier | Memory allocation error callback. |
| MprMemStats | Memory allocator statistics. |
| MprModuleEntry | Loadable module entry point signature. |
| MprModuleProc | Module start/stop point function signature. |
| MprMutex | Multithreading lock control structure. |
| MprOff | Signed file offset data type. |
| MprRegion | Memmory regions allocated from the O/S. |
| MprRomInode | A RomInode is created for each file in the Rom file system. |
| MprSignalInfo | Per signal structure. |
| MprSignalProc | Signal callback procedure. |
| MprSignalService | Signal service control. |
| MprSocketPrebind | Callback before binding a socket. |
| MprSocketProc | Socket I/O callback procedure. |
| MprSocketProvider | Socket service provider interface. |
| MprSocketService | Mpr socket service class. |
| MprSortProc | Quicksort callback function. |
| MprSpin | Multithreading spin lock control structure. |
| MprTerminator | Service shutdown notifier. |
| MprTestCase | Test case structure. |
| MprTestDef | Test case definition. |
| MprTestFailure | Test failure record. |
| MprTestGroup | A test group is a group of tests to cover a unit of functionality. |
| MprTestParser | Callback parser for non-standard command line arguments. |
| MprTestProc | Unit test callback procedure. |
| MprThreadLocal | Thread local data storage. |
| MprThreadProc | Thread main procedure. |
| MprThreadService | Thread service. |
| MprTicks | Elapsed time data type. |
| MprWaitService | Wait Service. |
| MprWorkerProc | Worker thread callback signature. |
| MprWorkerService | Worker Thread Service. |
| MprWorkerStats | Statistics for Workers. |
| MprXmlHandler | XML callback handler. |
| MprXmlInputStream | XML input stream function. |
| Socket | Argument for sockets. |
| size_t | Unsigned integral type. |
| #define | BIT_MAX_EVENTS 32 |
| Maximum number of notifier events. | |
| #define | BIT_MPR_LOGGING 1 |
| Default for logging is "on". | |
| #define | BIT_MPR_MAX_PASSWORD 256 |
| Max password length. | |
| #define | MPR_ALLOC_MANAGER 0x1 |
| Reserve room for a manager. | |
| #define | MPR_ALLOC_PAD_MASK 0x1 |
| Flags that impact padding. | |
| #define | MPR_ALLOC_POLICY_EXIT 3 |
| Exit the app if maxHeap exceeded. | |
| #define | MPR_ALLOC_POLICY_NOTHING 0 |
| Do nothing. | |
| #define | MPR_ALLOC_POLICY_PRUNE 1 |
| Prune all non-essential memory and continue. | |
| #define | MPR_ALLOC_POLICY_RESTART 2 |
| Gracefully restart the app if memory maxHeap level is exceeded. | |
| #define | MPR_ALLOC_ZERO 0x2 |
| Zero memory. | |
| #define | MPR_ARGV_ARGS_ONLY 0x1 |
| Command is missing program name. | |
| #define | MPR_ASSERT_MSG 0x10 |
| Originated from assert. | |
| #define | MPR_BACKGROUND_PRIORITY 15 |
| May only get CPU if idle. | |
| #define | MPR_CACHE_ADD 0x2 |
| mprWriteCache option to add key only if not already existing. | |
| #define | MPR_CACHE_APPEND 0x8 |
| mprWriteCache option to set and append if already existing. | |
| #define | MPR_CACHE_NOTIFY_CREATE 1 |
| Item has been created. | |
| #define | MPR_CACHE_NOTIFY_REMOVE 2 |
| Item is about to be removed. | |
| #define | MPR_CACHE_NOTIFY_UPDATE 4 |
| Item has been updated. | |
| #define | MPR_CACHE_PREPEND 0x10 |
| mprWriteCache option to set and prepend if already existing. | |
| #define | MPR_CACHE_SET 0x4 |
| mprWriteCache option to update key value, create if required. | |
| #define | MPR_CACHE_SHARED 0x1 |
| Use shared cache for mprCreateCache() | |
| #define | MPR_CG_DEFAULT 0x0 |
| mprGC flag to run GC if necessary. | |
| #define | MPR_CMD_DETACH 0x4 |
| mprRunCmd flag to detach the child process and don't wait. | |
| #define | MPR_CMD_ERR 0x4000 |
| mprRunCmd flag to capture stdout. | |
| #define | MPR_CMD_EXACT_ENV 0x8 |
| mprRunCmd flag to use the exact environment (no inherit from parent). | |
| #define | MPR_CMD_IN 0x1000 |
| mprRunCmd flag to connect to stdin. | |
| #define | MPR_CMD_NEW_SESSION 0x1 |
| mprRunCmd flag to create a new session on unix. | |
| #define | MPR_CMD_OUT 0x2000 |
| mprRunCmd flag to capture stdout. | |
| #define | MPR_CMD_SHOW 0x2 |
| mprRunCmd flag to show the window of the created process on windows. | |
| #define | MPR_CMD_STDERR 2 |
| Stderr for the client side. | |
| #define | MPR_CMD_STDIN 0 |
| Stdout for the client side. | |
| #define | MPR_CMD_STDOUT 1 |
| Stdin for the client side. | |
| #define | MPR_CMD_VXWORKS_EOF "_ _EOF_ _" |
| Special string for VxWorks CGI to emit to signal EOF. | |
| #define | MPR_CMD_VXWORKS_EOF_LEN 9 |
| Length of MPR_CMD_VXWORKS_EOF. | |
| #define | MPR_CREATED 1 |
| Applicationa and MPR services started. | |
| #define | MPR_CRITICAL_PRIORITY 99 |
| May not yield. | |
| #define | MPR_DAEMON 0x10 |
| Make the process a daemon. | |
| #define | MPR_DEBUG 4 |
| Debug information trace level. | |
| #define | MPR_DECODE_TOKEQ 1 |
| Decode base 64 blocks up to a NULL or equals. | |
| #define | MPR_DEFAULT_DATE "%a %b %d %T %Y %Z" |
| Default date format used in mprFormatLocalTime/mprFormatUniversalTime when no format supplied. | |
| #define | MPR_DEFAULT_MAX_THREADS 5 |
| Default max threads. | |
| #define | MPR_DEFAULT_MIN_THREADS 0 |
| Default min threads. | |
| #define | MPR_DELAY_GC_THREAD 0x8 |
| Delay starting the GC thread. | |
| #define | MPR_DESTROYED 6 |
| Application and MPR object destroyed. | |
| #define | MPR_DESTROYING 5 |
| Destroying core MPR services and releasing memory. | |
| #define | MPR_DIAG 3 |
| Diagnostic trace level. | |
| #define | MPR_DISABLE_GC 0x1 |
| Disable GC. | |
| #define | MPR_DISPATCHER_AUTO 0x8 |
| Dispatcher was auto created in response to accept event. | |
| #define | MPR_DISPATCHER_DESTROYED 0x4 |
| Dispatcher has been destroyed. | |
| #define | MPR_DISPATCHER_IMMEDIATE 0x1 |
| Dispatcher should run using the service events thread. | |
| #define | MPR_DISPATCHER_WAITING 0x2 |
| Dispatcher waiting for an event in mprWaitForEvent. | |
| #define | MPR_ERR -1 |
| Default error code. | |
| #define | MPR_ERR_ABORTED -2 |
| Action aborted. | |
| #define | MPR_ERR_ALREADY_EXISTS -3 |
| Item already exists. | |
| #define | MPR_ERR_BAD_ARGS -4 |
| Bad arguments or paramaeters. | |
| #define | MPR_ERR_BAD_FORMAT -5 |
| Bad input format. | |
| #define | MPR_ERR_BAD_HANDLE -6 |
| Bad file handle. | |
| #define | MPR_ERR_BAD_STATE -7 |
| Module is in a bad state. | |
| #define | MPR_ERR_BAD_SYNTAX -8 |
| Input has bad syntax. | |
| #define | MPR_ERR_BAD_TYPE -9 |
| Bad object type. | |
| #define | MPR_ERR_BAD_VALUE -10 |
| Bad or unexpected value. | |
| #define | MPR_ERR_BASE -1 |
| Base error code. | |
| #define | MPR_ERR_BUSY -11 |
| Resource is busy. | |
| #define | MPR_ERR_CANT_ACCESS -12 |
| Cannot access the file or resource. | |
| #define | MPR_ERR_CANT_ALLOCATE -13 |
| Cannot allocate resource. | |
| #define | MPR_ERR_CANT_COMPLETE -14 |
| Operation can't complete. | |
| #define | MPR_ERR_CANT_CONNECT -15 |
| Cannot connect to network or resource. | |
| #define | MPR_ERR_CANT_CREATE -16 |
| Cannot create the file or resource. | |
| #define | MPR_ERR_CANT_DELETE -17 |
| Cannot delete the resource. | |
| #define | MPR_ERR_CANT_FIND -18 |
| Cannot find resource. | |
| #define | MPR_ERR_CANT_INITIALIZE -19 |
| Cannot initialize resource. | |
| #define | MPR_ERR_CANT_LOAD -20 |
| Cannot load the resource. | |
| #define | MPR_ERR_CANT_OPEN -21 |
| Cannot open the file or resource. | |
| #define | MPR_ERR_CANT_READ -22 |
| Cannot read from the file or resource. | |
| #define | MPR_ERR_CANT_WRITE -23 |
| Cannot write to the file or resource. | |
| #define | MPR_ERR_DELETED -24 |
| Resource has been deleted. | |
| #define | MPR_ERR_MEMORY -25 |
| Memory allocation error. | |
| #define | MPR_ERR_NETWORK -26 |
| Underlying network error. | |
| #define | MPR_ERR_NOT_INITIALIZED -27 |
| Module or resource is not initialized. | |
| #define | MPR_ERR_NOT_READY -28 |
| Resource is not ready. | |
| #define | MPR_ERR_OK 0 |
| Success. | |
| #define | MPR_ERR_READ_ONLY -29 |
| The operation timed out. | |
| #define | MPR_ERR_TIMEOUT -30 |
| Operation exceeded specified time allowed. | |
| #define | MPR_ERR_TOO_MANY -31 |
| Too many requests or resources. | |
| #define | MPR_ERR_WONT_FIT -32 |
| Requested operation won't fit in available space. | |
| #define | MPR_ERR_WOULD_BLOCK -33 |
| Blocking operation would block. | |
| #define | MPR_ERROR 0 |
| Standard logging trace levels are 0 to 9 with 0 being the most verbose. | |
| #define | MPR_ERROR_MSG 0x20 |
| Originated from mprError. | |
| #define | MPR_EVENT_ASYNC 1 |
| Windows async select. | |
| #define | MPR_EVENT_BLOCK 0x20 |
| Blocking flag for mprCreateEventOutside. | |
| #define | MPR_EVENT_CONTINUOUS 0x1 |
| Timer event runs is automatically rescheduled. | |
| #define | MPR_EVENT_DONT_QUEUE 0x4 |
| Don't queue the event. | |
| #define | MPR_EVENT_EPOLL 2 |
| epoll_wait. | |
| #define | MPR_EVENT_KQUEUE 3 |
| BSD kqueue. | |
| #define | MPR_EVENT_PRIORITY 50 |
| Normal priority. | |
| #define | MPR_EVENT_QUICK 0x2 |
| Execute inline without executing via a thread. | |
| #define | MPR_EVENT_RUNNING 0x10 |
| Event currently executing. | |
| #define | MPR_EVENT_SELECT 4 |
| traditional select(). | |
| #define | MPR_EVENT_STATIC_DATA 0x8 |
| Event data is permanent and should not be marked by GC. | |
| #define | MPR_EVENT_TIME_SLICE 20 /* 20 msec */ |
| Events. | |
| #define | MPR_EXIT_ABORT 0x1 |
| Abort everything and call exit(). | |
| #define | MPR_EXIT_NORMAL 0x0 |
| Normal (graceful) exit. | |
| #define | MPR_EXIT_RESTART 0x4 |
| Restart after exiting. | |
| #define | MPR_EXIT_SAFE 0x2 |
| Graceful shutdown only if all requests complete. | |
| #define | MPR_EXIT_TIMEOUT -1 |
| Use timeout specified via mprSetExitTimeout | |
| #define | MPR_FATAL_MSG 0x800 |
| Fatal error, log and exit. | |
| #define | MPR_GC_COMPLETE 0x4 |
| mprGC flag to force start a GC and wait until the GC cycle fully completes including sweep phase. | |
| #define | MPR_GC_FORCE 0x1 |
| mprGC flag to force start a GC sweep whether it is required or not. | |
| #define | MPR_GC_NO_BLOCK 0x2 |
| mprGC flag to run GC if ncessary and return without yielding. | |
| #define | MPR_HASH_CASELESS 0x10 |
| Key comparisons ignore case. | |
| #define | MPR_HASH_STABLE 0x400 |
| Contents are stable or only accessed by one thread. | |
| #define | MPR_HASH_STATIC_KEYS 0x40 |
| Keys are permanent - don't dup or mark. | |
| #define | MPR_HASH_STATIC_VALUES 0x80 |
| Values are permanent - don't mark. | |
| #define | MPR_HASH_UNICODE 0x20 |
| Hash keys are unicode strings. | |
| #define | MPR_HASH_UNIQUE 0x200 |
| Add to existing will fail. | |
| #define | MPR_HTTP_DATE "%a, %d %b %Y %T GMT" |
| Date format for use in HTTP (headers). | |
| #define | MPR_INFO 2 |
| Configuration settings trace level. | |
| #define | MPR_INFO_MSG 0x40 |
| Originated from mprInfo. | |
| #define | MPR_JSON_ARRAY 0x2 |
| The property is an array. | |
| #define | MPR_JSON_DUPLICATE 0x8 |
| Permit duplicate properties of the same name. | |
| #define | MPR_JSON_FALSE 0x8 |
| The property is false. | |
| #define | MPR_JSON_NULL 0x10 |
| The property is null. | |
| #define | MPR_JSON_NUMBER 0x20 |
| The property is a number. | |
| #define | MPR_JSON_OBJ 0x1 |
| The property is an object. | |
| #define | MPR_JSON_OVERWRITE 0x1 |
| Overwrite existing properties. | |
| #define | MPR_JSON_PRETTY 0x1 |
| Serialize output in a more human readable, multiline "pretty" format. | |
| #define | MPR_JSON_QUOTES 0x2 |
| Serialize output quoting keys. | |
| #define | MPR_JSON_REGEXP 0x40 |
| The property is a regular expression. | |
| #define | MPR_JSON_REMOVE 0x1 |
| Remove matching properties. | |
| #define | MPR_JSON_SIMPLE 0x2 |
| Simple property names without query expressions. | |
| #define | MPR_JSON_STRING 0x80 |
| The property is a string. | |
| #define | MPR_JSON_STRINGS 0x4 |
| Emit all values as quoted strings. | |
| #define | MPR_JSON_TOP 0x4 |
| Query top level properties only. | |
| #define | MPR_JSON_TRUE 0x100 |
| The property is true. | |
| #define | MPR_JSON_UNDEFINED 0x200 |
| The property is undefined. | |
| #define | MPR_JSON_VALUE 0x4 |
| The property is a value (false|true|null|undefined|regexp|number|string). | |
| #define | MPR_LEVEL_MASK 0xf |
| Level mask. | |
| #define | MPR_LIST_STABLE 0x40 |
| Contents are stable or only accessed by one thread. | |
| #define | MPR_LIST_STATIC_VALUES 0x20 |
| Flag for mprCreateList when values are permanent. | |
| #define | MPR_LOCAL_TIMEZONE MAXINT |
| Constants for mprParseTime. | |
| #define | MPR_LOG_ANEW 0x20 |
| Start anew on boot (rotate). | |
| #define | MPR_LOG_APPEND 0x10 |
| Append to existing log files. | |
| #define | MPR_LOG_MSG 0x80 |
| Originated from mprLog. | |
| #define | MPR_MANAGE_FREE 0x1 |
| Block being freed. | |
| #define | MPR_MANAGE_MARK 0x2 |
| Block being marked by GC. | |
| #define | MPR_MAX_FILE 256 |
| Maximum number of files to close when forking. | |
| #define | MPR_MEM_FAIL 0x4 |
| Memory allocation failed - immediate exit. | |
| #define | MPR_MEM_LIMIT 0x2 |
| Memory use exceeds memory limit - invoking policy. | |
| #define | MPR_MEM_TOO_BIG 0x4 |
| Memory allocation request is too big - immediate exit. | |
| #define | MPR_MEM_WARNING 0x1 |
| Memory use exceeds warnHeap level limit. | |
| #define | MPR_MIN_TIME_FOR_GC 2 |
| Wait till 2 milliseconds of idle time possible. | |
| #define | MPR_MODULE_STARTED 0x1 |
| Module stared. | |
| #define | MPR_MODULE_STOPPED 0x2 |
| Module stopped. | |
| #define | MPR_NO_WINDOW 0x4 |
| Don't create a windows Window. | |
| #define | MPR_NORMAL_PRIORITY 50 |
| Normal (default) priority. | |
| #define | MPR_OBJ_HASH 0x1 |
| Object is a hash. | |
| #define | MPR_OBJ_LIST 0x1 |
| Object is a hash. | |
| #define | MPR_PATH_DEPTH_FIRST 0x2 |
| Flag for mprGetPathFiles to do a depth-first traversal. | |
| #define | MPR_PATH_DESCEND 0x1 |
| Flag for mprGetPathFiles to traverse subdirectories. | |
| #define | MPR_PATH_INC_HIDDEN 0x4 |
| Flag for mprGetPathFiles to include hidden files. | |
| #define | MPR_PATH_NODIRS 0x8 |
| Flag for mprGetPathFiles to exclude subdirectories. | |
| #define | MPR_PATH_RELATIVE 0x10 |
| Flag for mprGetPathFiles to return paths relative to the directory. | |
| #define | MPR_PROTO_ALL 0x1F |
| All SSL protocols. | |
| #define | MPR_PROTO_SSLV2 0x1 |
| SSL V2 protocol. | |
| #define | MPR_PROTO_SSLV3 0x2 |
| SSL V3 protocol. | |
| #define | MPR_PROTO_TLSV1 0x4 |
| TLS V1 protocol. | |
| #define | MPR_PROTO_TLSV11 0x8 |
| TLS V1.1 protocol. | |
| #define | MPR_PROTO_TLSV12 0x10 |
| TLS V1.2 protocol. | |
| #define | MPR_RAW_MSG 0x100 |
| Raw message output. | |
| #define | MPR_READABLE 0x2 |
| Read event mask. | |
| #define | MPR_REQUEST_PRIORITY 50 |
| Normal priority. | |
| #define | MPR_RFC3399_DATE "%FT%TZ" |
| Date format for RFC 3399 for use in HTML 5. | |
| #define | MPR_RFC_DATE "%a, %d %b %Y %T %Z" |
| Format a date according to RFC822: (Fri, 07 Jan 2003 12:12:21 PDT). | |
| #define | MPR_SERVICE_NO_BLOCK 0x4 |
| Do not block in mprServiceEvents. | |
| #define | MPR_SERVICE_NO_GC 0x8 |
| Don't run GC. | |
| #define | MPR_SERVICE_ONE_THING |
| Wait for one event or one I/O. | |
| #define | MPR_SIGNAL_AFTER 0x2 |
| Flag to mprAddSignalHandler to run handler after existing handlers. | |
| #define | MPR_SIGNAL_BEFORE 0x1 |
| Flag to mprAddSignalHandler to run handler before existing handlers. | |
| #define | MPR_SOCKET_BLOCK 0x1 |
| Use blocking I/O. | |
| #define | MPR_SOCKET_BROADCAST 0x2 |
| Broadcast mode. | |
| #define | MPR_SOCKET_BUFFERED_READ 0x800 |
| Socket has buffered read data (in SSL stack). | |
| #define | MPR_SOCKET_BUFFERED_WRITE 0x1000 |
| Socket has buffered write data (in SSL stack). | |
| #define | MPR_SOCKET_CHECKED 0x2000 |
| Peer certificate has been checked. | |
| #define | MPR_SOCKET_CLOSED 0x4 |
| MprSocket has been closed. | |
| #define | MPR_SOCKET_CONNECTING 0x8 |
| MprSocket is connecting. | |
| #define | MPR_SOCKET_DATAGRAM 0x10 |
| Use datagrams. | |
| #define | MPR_SOCKET_DISCONNECTED 0x4000 |
| The mprDisconnectSocket has been called. | |
| #define | MPR_SOCKET_EOF 0x20 |
| Seen end of file. | |
| #define | MPR_SOCKET_GRACEFUL 1 |
| Do a graceful shutdown. | |
| #define | MPR_SOCKET_HANDSHAKING 0x8000 |
| Doing an SSL handshake. | |
| #define | MPR_SOCKET_LISTENER 0x40 |
| MprSocket is server listener. | |
| #define | MPR_SOCKET_NODELAY 0x100 |
| Disable Nagle algorithm. | |
| #define | MPR_SOCKET_NOREUSE 0x80 |
| Don't set SO_REUSEADDR option. | |
| #define | MPR_SOCKET_SERVER 0x400 |
| Socket is on the server-side. | |
| #define | MPR_SOCKET_THREAD 0x200 |
| Process callbacks on a worker thread. | |
| #define | MPR_STARTED 2 |
| Applicationa and MPR services started. | |
| #define | MPR_STOPPED 4 |
| App is idle and now stopped. | |
| #define | MPR_STOPPING 3 |
| App has been instructed to shutdown. | |
| #define | MPR_TICKS_PER_SEC 1000 |
| Time ticks per second. | |
| #define | MPR_TIMEOUT_GC_SYNC 100 |
| Short wait period for threads to synchronize. | |
| #define | MPR_TIMEOUT_LINGER 2000 |
| Close socket linger timeout. | |
| #define | MPR_TIMEOUT_NAP 20 |
| Short pause. | |
| #define | MPR_TIMEOUT_NO_BUSY 1000 |
| Wait period to minimize CPU drain. | |
| #define | MPR_TIMEOUT_PRUNER 120000 |
| Time between worker thread pruner runs (2 min). | |
| #define | MPR_TIMEOUT_START_TASK 10000 |
| Time to start tasks running. | |
| #define | MPR_TIMEOUT_STOP 30000 |
| Default wait when stopping resources (30 sec). | |
| #define | MPR_TIMEOUT_STOP_TASK 10000 |
| Time to stop or reap tasks (vxworks). | |
| #define | MPR_TIMEOUT_WORKER 60000 |
| Prune worker that has been idle for 1 min. | |
| #define | MPR_TRACE_MSG 0x200 |
| Originated from mprTrace. | |
| #define | MPR_TRIM_BOTH 0x3 |
| Flag for strim to trim from both the start and the end of the string. | |
| #define | MPR_TRIM_END 0x2 |
| Flag for strim to trim from the end of the string. | |
| #define | MPR_TRIM_START 0x1 |
| Flag for strim to trim from the start of the string. | |
| #define | MPR_USER_EVENTS_THREAD 0x2 |
| User will explicitly manage own mprServiceEvents calls. | |
| #define | MPR_UTC_TIMEZONE 0 |
| Use UTC timezone. | |
| #define | MPR_VERBOSE 9 |
| Highest level of trace. | |
| #define | MPR_WAIT_IMMEDIATE 0x4 |
| Wait handler flag to immediately service event on same thread. | |
| #define | MPR_WAIT_NEW_DISPATCHER 0x2 |
| Wait handler flag to create a new dispatcher for each I/O event. | |
| #define | MPR_WAIT_NOT_SOCKET 0x8 |
| I/O file descriptor is not a socket - windows will ignore. | |
| #define | MPR_WAIT_RECALL_HANDLER 0x1 |
| Wait handler flag to recall the handler asap. | |
| #define | MPR_WARN 1 |
| Soft warning trace level. | |
| #define | MPR_WARN_MSG 0x400 |
| Originated from mprWarn. | |
| #define | MPR_WORKER_BUSY 0x1 |
| Worker currently running to a callback. | |
| #define | MPR_WORKER_IDLE 0x4 |
| Worker is sleeping (idle) on idleCond. | |
| #define | MPR_WORKER_PRIORITY 50 |
| Normal priority. | |
| #define | MPR_WORKER_PRUNED 0x2 |
| Worker has been pruned and will be terminated. | |
| #define | MPR_WRITABLE 0x4 |
| Write event mask. | |
| #define | MPR_XML_AFTER_LS 2 |
| Seen "<". | |
| #define | MPR_XML_ATT_EQ 6 |
| Seen "<tag att" =. | |
| #define | MPR_XML_ATT_NAME 5 |
| Seen "<tag att". | |
| #define | MPR_XML_BEGIN 1 |
| Before next tag. | |
| #define | MPR_XML_CDATA 13 |
| Seen "<![CDATA[" U. | |
| #define | MPR_XML_COMMENT 3 |
| Seen "<!–" (usr) U. | |
| #define | MPR_XML_ELT_DATA 10 |
| Seen "<tag>....<" U. | |
| #define | MPR_XML_ELT_DEFINED 9 |
| Seen "<tag...>" U. | |
| #define | MPR_XML_END_ELT 11 |
| Seen "<tag>....</tag>" U. | |
| #define | MPR_XML_EOF -2 |
| End of input. | |
| #define | MPR_XML_ERR -1 |
| Error. | |
| #define | MPR_XML_NEW_ATT 7 |
| Seen "<tag att = "val" U. | |
| #define | MPR_XML_NEW_ELT 4 |
| Seen "<tag" (usr) U. | |
| #define | MPR_XML_PI 12 |
| Seen "<?processingInst" U. | |
| #define | MPR_XML_SOLO_ELT_DEFINED 8 |
| Seen "<tag../>" U. | |
| #define | MPR_YIELD_COMPLETE 0x1 |
| mprYield flag to wait until the GC entirely completes including sweep phase. | |
| #define | MPR_YIELD_DEFAULT 0x0 |
| mprYield flag if GC is required, yield and wait for mark phase to coplete, otherwise return without blocking. | |
| #define | MPR_YIELD_STICKY 0x2 |
| mprYield flag to yield and remain yielded until reset. | |
| #define | tassert |
| Assert macro for use by unit tests. | |
| #define | tassert |
| Assert macro for use by unit tests. |
Primary MPR application control structure.
| char * | appDir | Path of directory containing app executable. | |
| char * | appPath | Path name of application executable. | |
| void * | appwebService | Appweb service object. | |
| char ** | argBuf | Space for allocated argv. | |
| int | argc | Count of command line args. | |
| cchar ** | argv | Application command line args (not alloced). | |
| bool | cmdlineLogging |
App has specified |
|
| struct MprCmdService * | cmdService | Command service object. | |
| MprCond * | cond | Sync after starting events thread. | |
| bool | debugMode | Run in debug mode (no timers). | |
| struct MprDispatcher * | dispatcher | Primary dispatcher. | |
| char * | domainName | Domain portion. | |
| void * | ediService | EDI object. | |
| void * | ejsService | Ejscript service. | |
| char * | emptyString | "" string. | |
| void * | espService | ESP service object. | |
| int | eventing | Servicing events thread is active. | |
| struct MprEventService * | eventService | Event service object. | |
| int | exitStrategy | How to exit the app. | |
| MprTicks | exitTimeout | Request timeout when exiting. | |
| struct MprFileSystem * | fileSystem | File system service object. | |
| int | flags | Misc flags. | |
| int | hasError | Mpr has an initialization error. | |
| MprHeap * | heap | Memory heap control. | |
| char * | hostName | Host name (fully qualified name). | |
| void * | httpService | Http service object. | |
| MprIdleCallback | idleCallback | Invoked to determine if the process is idle. | |
| char * | ip | Public IP Address. | |
| int | logBackup | Number of log files preserved when backing up. | |
| MprFile * | logFile | Log file. | |
| MprLogHandler | logHandler | Current log handler callback. | |
| int | logLevel | Log trace level. | |
| cchar * | logPath | Log path name. | |
| ssize | logSize | Maximum log size. | |
| MprOsThread | mainOsThread | Main OS thread ID. | |
| MprHash * | mimeTypes | Table of mime types. | |
| struct MprModuleService * | moduleService | Module service object. | |
| MprMutex * | mutex | Thread synchronization used for global lock. | |
| char * | name | Product name. | |
| struct MprDispatcher * | nonBlock | Nonblocking dispatcher. | |
| char * | oneString | "1" string. | |
| struct MprOsService * | osService | O/S service object. | |
| char * | pathEnv | Cached PATH env var. Used by MprCmd. | |
| char * | serverName | Server name portion (no domain). | |
| MprTicks | shutdownStarted | When the shutdown started. | |
| struct MprSignalService * | signalService | Signal service object. | |
| struct MprSocketService * | socketService | Socket service object. | |
| MprSpin * | spin | Quick thread synchronization. | |
| MprTime | start | When the MPR started. | |
| MprFile * | stdError | Standard error file. | |
| MprFile * | stdInput | Standard input file. | |
| MprFile * | stdOutput | Standard output file. | |
| MprList * | terminators | Termination callbacks. | |
| void * | testService | Test service object. | |
| struct MprThreadService * | threadService | Thread service object. | |
| MprHash * | timeTokens | Date/Time parsing tokens. | |
| char * | title | Product title. | |
| int | verifySsl | Default verification of SSL certificates. | |
| char * | version | Product version. | |
| struct MprWaitService * | waitService | IO Waiting service object. | |
| struct MprWorkerService * | workerService | Worker service object. |
Assert that a condition is true.
| cond | Boolean result of a conditional test. |
Add a service terminator.
| terminator | MprTerminator callback function. |
Trigger a breakpoint.
Cancel a shutdown request.
Check a plain-text password against the defined hashed password.
| plainTextPassword | User's plain-text-password to check. |
| passwordHash | Required password in hashed format previously computed by mprMakePassword. |
Initialize the application by creating an instance of the MPR.
| argc | Count of command line args. |
| argv | Command line arguments for the application. Arguments may be passed into the Mpr for retrieval by the unit test framework. |
| flags | Set MPR_USER_EVENTS_THREAD if you will manage calling mprServiceEvents manually if required. There are three styles of MPR applications with respect to servicing events: 1) Applications that don't require servicing events for I/O, commands or timers 2) Applications that call mprServiceEvents directly from their main program 3) Applications that have a dedicated service events thread Applications that do not perform I/O, run commands or create events may not need a service events thread. While creating one will do no harm, performance may be enhanced for these applications by specifying MPR_USER_EVENTS_THREAD. Applications that have not forground processing requirements may invoke mprServiceEvents from their main program instead of creating a service events thread. This saves one thread. The default is to create a service events thread so the full scope of MPR services are supported. |
Create and initialze the O/S dependent subsystem.
Encrypt a password using the Blowfish algorithm.
| password | User's password to encrypt. |
| salt | Salt text to add to password. Helps to make each user's password unique. |
| rounds | Number of times to encrypt. More times, makes the routine slower and passwords harder to crack. |
Convert the process into a daemon on unix systems.
Decode a null terminated string using base-46 encoding.
| str | String to decode. |
Decode a null terminated string using base-46 encoding.
| buf | String to decode. |
| len | Return parameter with the Length of the decoded data. |
| flags | Set to MPR_DECODE_TOKEQ to stop at the first '='. |
Destroy the MPR and all services using the MPR.
Reference to a permanent preallocated empty string.
Encode a string using base-46 encoding.
| str | String to encode. |
Encode buffer using base-46 encoding.
| buf | Buffer to encode. |
| len | Length of the buffer to encode. |
Encode a string escaping typical command (shell) characters.
| cmd | Command string to encode. |
| escChar | Escape character to use when encoding the command. |
Encode a string by escaping typical HTML characters.
| html | HTML content to encode. |
Encode a string by escaping SQL special characters.
| cmd | SQL command to encode. |
Get the application directory.
Get the application name defined via mprSetAppName.
Get the application executable path.
Get the application title string.
Get the application version string.
Get if command line logging is being used.
Get the debug mode.
Get the application domain name string.
Return the endian byte ordering for the application.
Return the error code for the most recent system or library operation.
Get the exit status.
Get the application host name string.
Get the application IP address string.
Get the current logging level.
Get an MD5 checksum.
| str | String to examine. |
Get an MD5 checksum with optional prefix string and buffer length.
| buf | Buffer to checksum. |
| len | Size of the buffer. |
| prefix | String prefix to insert at the start of the result. |
Return the MPR control instance.
Return the O/S error code.
Get a password from the terminal console.
| prompt | Text prompt to display before reading the password. |
Get some random data.
| buf | Reference to a buffer to hold the random data. |
| size | Size of the buffer. |
| block | Set to true if it is acceptable to block while accumulating entropy sufficient to provide good random data. Setting to false will cause this API to not block and may return random data of a lower quality. |
Get some random data in ascii.
| size | Size of the random data string. |
Get the application server name string.
Get an SHA1 checksum.
| str | String to examine. |
Get an SHA1 checksum of a null terminated string.
| str | String to checksum. |
Get an SHA1 checksum with optional prefix string and buffer length.
| buf | Buffer to checksum. |
| len | Size of the buffer. |
| prefix | String prefix to insert at the start of the result. |
Get the MPR execution state.
Determine if the MPR has finished.
Test if the application is terminating and core services are being destroyed All request should immediately terminate.
Determine if the App is idle.
| traceRequests | If true, emit trace regarding running requests. |
Test if the application is stopped If this routine returns true, the application shutdown has passed the point of no return.
No new requests should be accepted and current requests should be aborted. Use #mprIsStopping to test if shutdown has been initiated but current requests may continue. Use #mprIsDestroyed to test if the application has completed its shutdownTest if the application is stopping If mprIsStopping is true, the application has commenced a shutdown.
No new requests should be accepted and current request should complete if possible. Use mprIsDestroyed to test if the application has completed its shutdownMake a argv style array of command arguments.
| command | Command string to parse. |
| argv | Output parameter containing the parsed arguments. |
| flags | Set to MPR_ARGV_ARGS_ONLY if the command string does not contain a program name. In this case, argv[0] will be set to "". |
Make a password hash for a plain-text password using the Blowfish algorithm.
| password | User's password to encrypt. |
| saltLength | Length of salt text to add to password. Helps to make each user's password unique. |
| rounds | Number of times to encrypt. More times, makes the routine slower and passwords harder to crack. |
Make salt for adding to a password.
| size | Size in bytes of the salt text. |
Nap for a while.
| msec | Number of milliseconds to sleep. |
Make a argv style array of command arguments.
| command | Command string to parse. |
| argv | Array for the arguments. |
| maxArgs | Size of the argv array. |
Return a random number.
Restart the application.
Determine if the MPR services.
| traceRequests | If true, emit trace regarding running requests. |
Set the application name, title and version.
| name | One word, lower case name for the app. |
| title | Pascal case multi-word descriptive name. |
| version | Version of the app. Major-Minor-Patch. E.g. 1.2.3. |
Set the application executable path.
| path | A string containing the application executable path. |
Set if command line logging was requested.
| on | Set to true to indicate command line logging is being used. |
Turn on debug mode.
| on | Set to true to enable debugging mode. |
Set the application domain name string.
| s | New value to use for the application domain name. |
Set an environment variable value.
| key | Variable name. |
| value | Variable value. |
Set the proposed exit status.
| status | Proposed exit status value. |
Set the exit timeout for a shutdown.
| timeout | Time in milliseconds to wait for current requests to complete and the application to become idle. |
Set the maximum number of open file/socket descriptors.
| limit | Limit to enforce. |
Set the application host name string.
This is internal to the application and does not affect the O/S host name| s | New host name to use within the application. |
Define a new idle callback to be invoked by mprIsIdle()
| idleCallback | Callback function to invoke to test if the application is idle. |
Sete the application IP address string.
| ip | IP address string to store for the application. |
Set the O/S error code.
Set the application server name string.
| s | New application server name to use within the application. |
Test if requests should be aborted.
Test if new requests should be denied.
Initiate shutdown of the MPR and application.
| exitStrategy | Shutdown policy. If the MPR_EXIT_ABORT flag is specified, the application will immediately call exit() and will terminate without waiting for current requests to complete. This is not recommended for normal operation as data may be lost. If MPR_EXIT_SAFE is defined, the shutdown will be cancelled if all requests do not complete before the exit timeout defined via mprSetExitTimeout expires. Define the MPR_EXIT_RESTART flag for the application to automatically restart after exiting. Do not use this option if the application is using a watchdog/angel process to automatically restart the application (such as appman by appweb). |
| status | Proposed exit status to use when the application exits. See mprGetExitStatus |
| timeout | Exit timeout in milliseconds to wait for current requests to complete. If set to -1,. |
Sleep for a while.
| msec | Number of milliseconds to sleep. |
Start the Mpr services.
Start an thread dedicated to servicing events.
This will create a new thread and invoke mprServiceEventsStart the O/S dependent subsystem.
Stop the O/S dependent subsystem.
Decode a URI string by de-scaping URI characters.
| uri | URI to decode. |
Decode a URI string by de-scaping URI characters.
| uri | URI to decode. |
Encode a string by escaping URI characters.
| uri | URI to encode. |
| map | Map to encode characters. Select from MPR_ENCODE_URI or MPR_ENCODE_URI_COMPONENT. |
Dynamic Buffer Module.
| ssize | buflen | Current size of buffer. | |
| char * | data | Actual buffer for data. | |
| char * | end | Pointer one past the last data chr. | |
| char * | endbuf | Pointer one past the end of buffer. | |
| ssize | growBy | Next growth increment to use. | |
| ssize | maxsize | Max size the buffer can ever grow. | |
| void * | refillArg | Refill arg - must be alloced memory. | |
| MprBufProc | refillProc | Auto-refill procedure. | |
| char * | start | Pointer to next data char. |
Add a null character to the buffer contents.
| buf | Buffer created via mprCreateBuf. |
Adjust the buffer end position.
| buf | Buffer created via mprCreateBuf. |
| count | Positive or negative count of bytes to adjust the end position. |
Adjust the buffer start position.
| buf | Buffer created via mprCreateBuf. |
| count | Positive or negative count of bytes to adjust the start position. |
Convert the buffer contents to a string.
| buf | Buffer created via mprCreateBuf. |
Compact the buffer contents.
| buf | Buffer created via mprCreateBuf. |
Create a new buffer.
| initialSize | Initial size of the buffer. |
| maxSize | Maximum size the buffer can grow to. |
Flush the buffer contents.
| buf | Buffer created via mprCreateBuf. |
Get a block of data from the buffer.
| buf | Buffer created via mprCreateBuf. |
| blk | Destination block for the read data. |
| count | Count of bytes to read from the buffer. |
Get the origin of the buffer content storage.
| buf | Buffer created via mprCreateBuf. |
Get a reference to the end of the buffer contents.
| buf | Buffer created via mprCreateBuf. |
Get the buffer content length.
| buf | Buffer created via mprCreateBuf. |
Get the buffer refill procedure.
| buf | Buffer created via mprCreateBuf. |
Get the current size of the buffer content storage.
| buf | Buffer created via mprCreateBuf. |
Get the space available to store content.
| buf | Buffer created via mprCreateBuf. |
Get the start of the buffer contents.
| buf | Buffer created via mprCreateBuf. |
Get a character from the buffer.
| buf | Buffer created via mprCreateBuf. |
Grow the buffer.
| buf | Buffer created via mprCreateBuf. |
| count | Count of bytes by which to grow the buffer content size. |
Insert a character into the buffer.
| buf | Buffer created via mprCreateBuf. |
| c | Character to append. |
Peek at the last character in the buffer.
| buf | Buffer created via mprCreateBuf. |
Peek at the next character in the buffer.
| buf | Buffer created via mprCreateBuf. |
Put a block to the buffer.
| buf | Buffer created via mprCreateBuf. |
| ptr | Block to append. |
| size | Size of block to append. |
Put a character to the buffer.
| buf | Buffer created via mprCreateBuf. |
| c | Character to append. |
Put an integer to the buffer.
| buf | Buffer created via mprCreateBuf. |
| i | Integer to append to the buffer. |
Put padding characters to the buffer.
| buf | Buffer created via mprCreateBuf. |
| c | Character to append. |
| count | Count of pad characters to put. |
Put a string to the buffer.
| buf | Buffer created via mprCreateBuf. |
| str | String to append. |
Put a substring to the buffer.
| buf | Buffer created via mprCreateBuf. |
| str | String to append. |
| count | Put at most count characters to the buffer. |
Put a formatted string to the buffer.
| buf | Buffer created via mprCreateBuf. |
| fmt | Printf style format string. |
| ... | Variable arguments for the format string. |
Refill the buffer with data.
| buf | Buffer created via mprCreateBuf. |
Reset the buffer.
| buf | Buffer created via mprCreateBuf. |
Set the maximum buffer size.
| buf | Buffer created via mprCreateBuf. |
| maxSize | New maximum size the buffer can grow to. |
Set the buffer refill procedure.
| buf | Buffer created via mprCreateBuf. |
| fn | Callback function to store. |
| arg | Callback data argument. |
Set the buffer size.
| buf | Buffer created via mprCreateBuf. |
| size | Size to immediately make the buffer. If size is less than the current buffer size, it will be ignored. Set to -1 to ignore this parameter. |
| maxSize | Maximum size the buffer contents can grow to. |
In-memory caching.
| MprTicks | lifespan | Default lifespan (msec). | |
| ssize | maxKeys | Max number of keys. | |
| ssize | maxMem | Max memory for session data. | |
| MprMutex * | mutex | Cache lock. | |
| int | resolution | Frequence for pruner. | |
| struct MprCache * | shared | Shared common cache. | |
| MprHash * | store | Key/value store. | |
| MprEvent * | timer | Pruning timer. | |
| ssize | usedMem | Memory in use for keys and data. |
Create a new cache object.
| options | Set of option flags. Use MPR_CACHE_SHARED to select a global shared cache object. |
Destroy a new cache object.
| cache | The cache instance object returned from mprCreateCache |
Set the expiry date for a cache item.
| cache | The cache instance object returned from mprCreateCache |
| key | Cache item key. |
| expires | Time when the cache item will expire. If expires is zero, the item is immediately removed from the cache. |
Get the Cache statistics.
| cache | The cache instance object returned from mprCreateCache |
| numKeys | Number of keys currently stored. |
| mem | Memory in use to store keys. |
Increment a numeric cache item.
| cache | The cache instance object returned from mprCreateCache |
| key | Cache item key. |
| amount | Numeric amount to increment the cache item. This may be a negative number to decrement the item. |
Lookup an item in the cache.
| cache | The cache instance object returned from mprCreateCache |
| key | Cache item key. |
| modified | Optional MprTime value reference to receive the last modified time of the cache item. Set to null if not required. |
| version | Optional int64 value reference to receive the version number of the cache item. Set to null if not required. Cache items have a version number that is incremented every time the item is updated. |
Prune the cache.
| cache | The cache instance object returned from mprCreateCache |
Read an item from the cache.
| cache | The cache instance object returned from mprCreateCache |
| key | Cache item key. |
| modified | Optional MprTime value reference to receive the last modified time of the cache item. Set to null if not required. |
| version | Optional int64 value reference to receive the version number of the cache item. Set to null if not required. Cache items have a version number that is incremented every time the item is updated. |
Remove items from the cache.
| cache | The cache instance object returned from mprCreateCache |
| key | Cache item key. If set to null, then remove all keys from the cache. |
Set the cache resource limits.
| cache | The cache instance object returned from mprCreateCache |
| keys | Set the maximum number of keys the cache can store. |
| lifespan | Set the default lifespan for cache items in milliseconds. |
| memory | Memory limit in bytes for all cache keys and items. |
| resolution | Set the cache item pruner resolution. This defines how frequently the cache manager will check items for expiration. |
Set a linked managed memory reference for a cached item.
| cache | The cache instance object returned from mprCreateCache |
| key | Cache item key to write. |
| link | Managed memory reference. May be NULL. |
Set a notification callback to be invoked for events of interest on cached items.
WARNING: the callback may happen on any thread. Use careful locking to synchronize access to data. Take care not to block the thread issuing the callback| cache | The cache instance object returned from mprCreateCache |
| notify | MprCacheProc notification callback. Invoked for events of interest on cache items. The event is set to MPR_CACHE_NOTIFY_REMOVE when items are removed from the cache. Invoked as:. |
Write a cache item.
| cache | The cache instance object returned from mprCreateCache |
| key | Cache item key to write. |
| value | Value to set for the cache item. This must be allocated memory. |
| modified | Value to set for the cache last modified time. If set to zero, the current time is obtained via mprGetTime |
| lifespan | Lifespan of the item in milliseconds. The item will be removed from the cache by the Cache manager when the lifetime expires unless it is rewritten to extend the lifespan. |
| version | Expected version number of the item. This is used to do transactional writes to the cache item. First the version number is retrieved via mprReadCache and that version number is supplied to mprWriteCache when the item is updated. If another caller updates the item in between the read/write, the version number will not match when the item is subsequently written and this call will fail with the MPR_ERR_BAD_STATE return code. Set to zero if version checking is not required. |
| options | Options to control how the item value is updated. Use MPR_CACHE_SET to update the cache item and create if it does not exist. Use MPR_CACHE_ADD to add the item only if it does not already exits. Use MPR_CACHE_APPEND to append the parameter value to any existing cache item value. Use MPR_CACHE_PREPEND to prepend the value. |
Command execution Service.
| int | argc | Count of args in argv. | |
| cchar ** | argv | List of args. Null terminated. | |
| MprCmdProc | callback | Handler for client output and completion. | |
| int | complete | All channels EOF and status gathered. | |
| cchar ** | defaultEnv | Environment to use if no env passed to mprStartCmd. | |
| char * | dir | Current working dir for the process. | |
| MprDispatcher * | dispatcher | Dispatcher to use for wait events. | |
| MprList * | env | List of environment variables. Null terminated. | |
| int | eofCount | Count of end-of-files. | |
| MprCmdFile | files[MPR_CMD_MAX_PIPE] | Stdin, stdout for the command. | |
| int | flags | Control flags (userFlags not here). | |
| MprForkCallback | forkCallback | Forked client callback. | |
| cchar ** | makeArgv | Allocated argv. | |
| MprMutex * | mutex | Multithread sync. | |
| int | originalPid | Persistent copy of the pid. | |
| int | pid | Process ID of the created process. | |
| cchar * | program | Program path name. | |
| int | requiredEof | Number of EOFs required for an exit. | |
| char * | searchPath | Search path to use to locate the command. | |
| MprSignal * | signal | Signal handler for SIGCHLD. | |
| int | status | Command exit status. | |
| MprBuf * | stderrBuf | Standard error output from the client. | |
| MprBuf * | stdoutBuf | Standard output from the client. | |
| int | stopped | Command stopped. | |
| int | timedout | Request has timedout. | |
| void * | userData | User data storage. | |
| int | userFlags | User flags storage. |
Return true if command events are enabled.
| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
Close the command channel.
| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
Create a new Command object.
Destroy the command.
| cmd | MprCmd object created via mprCreateCmd. |
Disable command I/O events.
This disables events on a given channel| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
Disconnect a command its underlying I/O channels.
This is used to prevent further I/O wait events while still preserving the MprCmd object| cmd | MprCmd object created via mprCreateCmd. |
Enable command I/O events.
This enables events on a given channel| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
Enable command I/O events for the command's STDOUT and STDERR channels.
| cmd | MprCmd object created via mprCreateCmd. |
| on | Set to true to enable events. Set to false to disable. |
Finalize the writing of data to the command process.
| cmd | MprCmd object created via mprCreateCmd. |
Get the count of active commands.
Get the underlying buffer for a channel.
| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
Get the command exit status.
| cmd | MprCmd object created via mprCreateCmd. |
Get the underlying file descriptor for an I/O channel.
| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to close. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
Test if the command is still running.
| cmd | MprCmd object created via mprCreateCmd. |
Poll for I/O on the command pipes.
This is only used on windows which can't adequately detect EOF on a named pipe| cmd | MprCmd object created via mprCreateCmd. |
| timeout | Time in milliseconds to wait for the command to complete and exit. |
Make the I/O channels to send and receive data to and from the command.
| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to read from. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
| buf | Buffer to read into. |
| bufsize | Size of buffer. |
Reap the command.
This waits for and collect the command exit status| cmd | MprCmd object created via mprCreateCmd. |
| timeout | Time in milliseconds to wait for the command to complete and exit. |
Run a simple blocking command using a string command line.
| dispatcher | MprDispatcher event queue to use for waiting. Set to NULL to use the default MPR dispatcher. |
| command | Command line to run. |
| input | Command input. Data to write to the command which will be received on the comamnds stdin. |
| output | Reference to a string to receive the stdout from the command. |
| error | Reference to a string to receive the stderr from the command. |
| timeout | Time in milliseconds to wait for the command to complete and exit. |
Run a command using a string command line.
This starts the command via mprStartCmd() and waits for its completion| cmd | MprCmd object created via mprCreateCmd. |
| command | Command line to run. |
| envp | Array of environment strings. Each environment string should be of the form: "KEY=VALUE". The array must be null terminated. |
| in | Command input. Data to write to the command which will be received on the comamnds stdin. |
| out | Reference to a string to receive the stdout from the command. |
| err | Reference to a string to receive the stderr from the command. |
| timeout | Time in milliseconds to wait for the command to complete and exit. |
| flags | Flags to modify execution. Valid flags are: MPR_CMD_NEW_SESSION Create a new session on Unix MPR_CMD_SHOW Show the commands window on Windows MPR_CMD_IN Connect to stdin MPR_CMD_OUT Capture stdout MPR_CMD_ERR Capture stderr MPR_CMD_EXACT_ENV Use the exact environment supplied. Don't inherit and blend with existing environment. |
Run a command using an argv[] array of arguments.
This invokes mprStartCmd() and waits for its completion| cmd | MprCmd object created via mprCreateCmd. |
| argc | Count of arguments in argv. |
| argv | Command arguments array. |
| envp | Array of environment strings. Each environment string should be of the form: "KEY=VALUE". The array must be null terminated. |
| in | Command input. Data to write to the command which will be received on the comamnds stdin. |
| out | Reference to a string to receive the stdout from the command. |
| err | Reference to a string to receive the stderr from the command. |
| timeout | Time in milliseconds to wait for the command to complete and exit. |
| flags | Flags to modify execution. Valid flags are: MPR_CMD_NEW_SESSION Create a new session on Unix MPR_CMD_SHOW Show the commands window on Windows MPR_CMD_IN Connect to stdin MPR_CMD_OUT Capture stdout MPR_CMD_ERR Capture stderr. |
Define a callback to be invoked to receive response data from the command.
| cmd | MprCmd object created via mprCreateCmd. |
| callback | Function of the signature MprCmdProc which will be invoked for receive notification for data from the commands stdout and stderr channels. MprCmdProc has the signature: int callback(MprCmd *cmd, int channel, void *data) {}. |
| data | User defined data to be passed to the callback. |
Set the default environment to use for commands.
| cmd | MprCmd object created via mprCreateCmd. |
| env | Array of environment "KEY=VALUE" strings. Null terminated. |
Set the home directory for the command.
| cmd | MprCmd object created via mprCreateCmd. |
| dir | String directory path name. |
Set the command environment.
| cmd | MprCmd object created via mprCreateCmd. |
| env | Array of environment strings. Each environment string should be of the form: "KEY=VALUE". The array must be null terminated. |
Set the default command search path.
| cmd | MprCmd object created via mprCreateCmd. |
| search | Search string. This is in a format similar to the PATH environment variable. |
Start the command.
This starts the command but does not wait for its completion. Once started, mprWriteCmd can be used to write to the command and response data can be received via mprReadCmd| cmd | MprCmd object created via mprCreateCmd. |
| argc | Count of arguments in argv. |
| argv | Command arguments array. |
| envp | Array of environment strings. Each environment string should be of the form: "KEY=VALUE". The array must be null terminated. |
| flags | Flags to modify execution. Valid flags are: MPR_CMD_NEW_SESSION Create a new session on Unix MPR_CMD_SHOW Show the commands window on Windows MPR_CMD_IN Connect to stdin. |
Stop the command.
The command is immediately killed| cmd | MprCmd object created via mprCreateCmd. |
| signal | Signal to send to the command to kill if required. |
Wait for the command to complete.
| cmd | MprCmd object created via mprCreateCmd. |
| timeout | Time in milliseconds to wait for the command to complete and exit. |
Write data to an I/O channel.
| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to read from. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
| buf | Buffer to read into. |
| bufsize | Size of buffer. |
Write data to an I/O channel.
| cmd | MprCmd object created via mprCreateCmd. |
| channel | Channel number to read from. Should be either MPR_CMD_STDIN, MPR_CMD_STDOUT or MPR_CMD_STDERR. |
| buf | Buffer to read into. |
| bufsize | Size of buffer. |
Event Dispatcher.
| MprCond * | cond | Multi-thread sync. | |
| MprEvent * | currentQ | Currently executing events. | |
| MprEvent * | eventQ | Event queue. | |
| int | flags | Dispatcher control flags. | |
| cchar * | name | Dispatcher name / purpose. | |
| struct MprDispatcher * | next | Next dispatcher linkage. | |
| MprOsThread | owner | Owning thread of the dispatcher. | |
| struct MprDispatcher * | parent | Queue pointer. | |
| struct MprDispatcher * | prev | Previous dispatcher linkage. | |
| struct MprEventService * | service | Event service reference. |
Clear the event service waiting flag.
Create a new event dispatcher.
| name | Useful name for debugging. |
| flags | Dispatcher flags. |
Disable a dispatcher from service events.
This removes the dispatcher from any dispatcher queues and allows it to be garbage collected| dispatcher | Dispatcher to disable. |
Get the MPR primary dispatcher.
Service events.
| delay | Time in milliseconds to wait. Set to zero for no wait. Set to -1 to wait forever. |
| flags | If set to MPR_SERVICE_NO_BLOCK, this call will service all due events without blocking. Otherwise set to zero. |
Set the maximum sleep time for the event service.
| delay | Maximum time to sleep before checking for events to service. |
Signal the dispatcher to wakeup and re-examine its queues.
| dispatcher | Event dispatcher to monitor. |
Wait for an event to occur on the given dispatcher.
| dispatcher | Event dispatcher to monitor. |
| timeout | for waiting in milliseconds. |
Wake the event service.
Event object.
| void * | data | Event private data. | |
| struct MprDispatcher * | dispatcher | Event dispatcher service. | |
| MprTicks | due | When is the event due. | |
| int | flags | Event flags. | |
| struct MprWaitHandler * | handler | Optional wait handler. | |
| int | mask | I/O mask of events. | |
| cchar * | name | Static debug name of the event. | |
| struct MprEvent * | next | Next event linkage. | |
| MprTicks | period | Reschedule period. | |
| struct MprEvent * | prev | Previous event linkage. | |
| MprEventProc | proc | Callback procedure. | |
| void * | sock | Optional socket data. | |
| MprTicks | timestamp | When was the event created. |
Create a new event.
| dispatcher | Dispatcher object created via mprCreateDispatcher. |
| name | Debug name of the event. |
| period | Time in milliseconds used by continuous events between firing of the event. |
| proc | Function to invoke when the event is run. |
| data | Data to associate with the event and stored in event->data. The data must be either an allocated memory object or MPR_EVENT_STATIC_DATA must be specified in flags. |
| flags | Flags to modify the behavior of the event. Valid values are: MPR_EVENT_CONTINUOUS to create an event which will be automatically rescheduled accoring to the specified period. Use MPR_EVENT_STATIC_DATA if the data argument does not point to an allocated memory object. |
Create an event from outside the MPR.
| dispatcher | Dispatcher object created via mprCreateDispatcher Set to NULL for the MPR dispatcher. Use MPR_EVENT_QUICK in the flags to run the event on the events nonBlock dispatcher. This should only be used for quick, non-block event callbacks. If using another dispatcher, it is essential that the dispatcher not be destroyed while this event is queued or running. Such dispatchers must be retained before calling mprCallEventOutside via mprAddRoot or mprHold before using with this routine. |
| name | Descriptive event name. Does not need to be unique. Can be null. |
| proc | Callback function to invoke when the event is run. |
| data | Data to associate with the event and stored in event->data. The data must be non-MPR memory. |
| flags | Set to MPR_EVENT_BLOCK to invoke the callback and wait for its completion before returning. Include MPR_EVENT_QUICK to execute the event without creating using a worker. This should only be used for quick non-blocking event callback.s. |
Create a timer event.
| dispatcher | Dispatcher object created via mprCreateDispatcher |
| name | Debug name of the event. |
| proc | Function to invoke when the event is run. |
| period | Time in milliseconds used by continuous events between firing of the event. |
| data | Data to associate with the event and stored in event->data. |
| flags | Reserved. Must be set to zero. |
Enable or disable an event being continous.
| event | Event object returned from mprCreateEvent |
| enable | Set to 1 to enable continous scheduling of the event. |
Remove an event.
| event | Event object returned from mprCreateEvent |
Reschedule an event.
| event | Event object returned from mprCreateEvent |
| period | Time in milliseconds used by continuous events between firing of the event. |
Restart an event.
| event | Event object returned from mprCreateEvent |
Stop an event.
| event | Event object returned from mprCreateEvent |
File I/O Module.
| int | attached | Attached to existing descriptor. | |
| MprBuf * | buf | Buffer for I/O if buffered. | |
| int | fd | File handle. | |
| MprFileSystem * | fileSystem | File system owning this file. | |
| MprRomInode * | inode | Reference to ROM file. | |
| MprOff | iopos | Raw I/O position. | |
| int | mode | File open mode. | |
| char * | path | Filename. | |
| int | perms | File permissions. | |
| MprOff | pos | Current read position. | |
| MprOff | size | Current file size. |
Attach to an existing file descriptor.
| fd | File descriptor to attach to. |
| name | Descriptive name for the file. |
| omode | Posix style file open mode mask. The open mode may contain the following mask values ored together:
|
Close a file.
| file | File instance returned from mprOpenFile |
Disable file buffering.
| file | File instance returned from mprOpenFile |
Enable file buffering.
| file | File instance returned from mprOpenFile |
| size | Size to allocate for the buffer. |
| maxSize | Maximum size the data buffer can grow to. |
Flush any buffered write data.
| file | Pointer to an MprFile object returned via MprOpen. |
Read a character from the file.
| file | Pointer to an MprFile object returned via MprOpen. |
Get the file descriptor for a file.
| file | File object returned via mprOpenFile |
Return the current file position.
| file | A file object returned from mprOpenFile |
Get the size of the file.
| file | A file object returned from mprOpenFile |
Return a file object for the Stderr I/O channel.
Return a file object for the Stdin I/O channel.
Return a file object for the Stdout I/O channel.
Open a file.
| filename | String containing the filename to open or create. |
| omode | Posix style file open mode mask. The open mode may contain the following mask values ored together:
|
| perms | Posix style file permissions mask. |
Non-destructively read a character from the file.
| file | Pointer to an MprFile object returned via MprOpen. |
Write a character to the file.
| file | Pointer to an MprFile object returned via MprOpen. |
| c | Character to write. |
Write a string to the file.
| file | Pointer to an MprFile object returned via MprOpen. |
| str | String to write. |
Read data from a file.
| file | Pointer to an MprFile object returned via MprOpen. |
| buf | Buffer to contain the read data. |
| size | Size of buf in characters. |
Read a line from the file.
| file | Pointer to an MprFile object returned via MprOpen. |
| size | Maximum number of characters in a line. |
| len | Pointer to an integer to hold the length of the returned string. |
Seek the I/O pointer to a new location in the file.
| file | Pointer to an MprFile object returned via MprOpen. |
| seekType | Seek type may be one of the following three values:
|
| distance | A positive or negative byte offset. |
Truncate a file.
| path | File to truncate. |
| size | New maximum size for the file. |
Write data to a file.
| file | Pointer to an MprFile object returned via MprOpen. |
| buf | Buffer containing the data to write. |
| count | Cound of characters in buf to write. |
Write formatted data to a file.
| file | Pointer to an MprFile object returned via MprOpen. |
| fmt | Format string. |
Write a string to a file.
| file | Pointer to an MprFile object returned via MprOpen. |
| str | String to write. |
File system service.
| MprAccessFileProc | accessPath | Virtual access file routine. | |
| bool | caseSensitive | Path comparisons are case sensitive. | |
| MprCloseFileProc | closeFile | Virtual close file routine. | |
| MprDeleteFileProc | deletePath | Virtual delete file routine. | |
| MprGetPathInfoProc | getPathInfo | Virtual get file information routine. | |
| MprGetPathLinkProc | getPathLink | Virtual get the symbolic link target. | |
| bool | hasDriveSpecs | Paths can have drive specifications. | |
| MprMakeDirProc | makeDir | Virtual make directory routine. | |
| MprMakeLinkProc | makeLink | Virtual make link routine. | |
| char * | newline | Newline for text files. | |
| MprOpenFileProc | openFile | Virtual open file routine. | |
| MprReadFileProc | readFile | Virtual read file routine. | |
| cchar * | root | Root file path. | |
| MprSeekFileProc | seekFile | Virtual seek file routine. | |
| char * | separators | Filename path separators. First separator is the preferred separator. | |
| MprSetBufferedProc | setBuffered | Virtual set buffered I/O routine. | |
| MprTruncateFileProc | truncateFile | Virtual truncate file routine. | |
| MprWriteFileProc | writeFile | Virtual write file routine. |
Create and initialize the disk FileSystem.
| fs | File system object. |
Create and initialize the FileSystem subsystem.
| path | Path name to the root of the file system. |
Create and initialize the ROM FileSystem.
| path | Path name to the root of the file system. |
Lookup a file system.
| path | Path representing a file in the file system. |
Set the file system new line character string.
| path | Path representing a file in the file system. |
| newline | String containing the newline character(s). "\\n". Windows uses "\\r\\n". |
Set the file system path separators.
| path | Path representing a file in the file system. |
| separators | String containing the directory path separators. Defaults to "/". Windows uses "/\/". |
Set the ROM file system data.
| inodeList | Reference to the ROM file system list of files (inodes). This is generated by the makerom tool. |
Floating Point Services.
Test if a double value is not-a-number.
| value | Value to test. |
Test if a double value is zero.
| value | Value to test. |
Hash table entry structure.
| MprKey ** | buckets | Hash collision bucket table. | |
| int | flags | Hash control flags. | |
| MprHashProc | fn | Hash function. | |
| int | length | Number of symbols in the table. | |
| MprMutex * | mutex | GC marker sync. | |
| int | size | Size of the buckets array. |
Add a duplicate symbol value into the hash table.
| table | Symbol table returned via mprCreateSymbolTable. |
| key | String key of the symbole entry to delete. |
| ptr | Arbitrary pointer to associate with the key in the table. |
Add a symbol value into the hash table.
| table | Symbol table returned via mprCreateSymbolTable. |
| key | String key of the symbole entry to delete. |
| ptr | Arbitrary pointer to associate with the key in the table. |
Add a key with a formatting value into the hash table.
| table | Symbol table returned via mprCreateSymbolTable. |
| key | String key of the symbole entry to delete. |
| fmt | Format string. See mprPrintf |
Add a symbol value into the hash table and set the key type.
| table | Symbol table returned via mprCreateSymbolTable. |
| key | String key of the symbole entry to delete. |
| ptr | Arbitrary pointer to associate with the key in the table. |
| type | Type of value. |
Blend two hash tables.
| target | Target hash to receive the properties from the other hash. |
| other | Hash to provide properties to blend. |
Copy a hash table.
| table | Symbol table returned via mprCreateSymbolTable. |
Create a hash table.
| hashSize | Size of the hash table for the symbol table. Should be a prime number. Set to 0 or -1 to get a default (small) hash table. |
| flags | Table control flags. Use MPR_HASH_CASELESS for case insensitive comparisions, MPR_HASH_UNICODE if the hash keys are unicode strings, MPR_HASH_STATIC_KEYS if the keys are permanent and should not be managed for Garbage collection, and MPR_HASH_STATIC_VALUES if the values are permanent. MPR_HASH_STABLE to create an optimized list when the contents are stable or only accessed by one thread. |
Create a hash of words.
| str | String containing white space or comma separated words. |
Return the first symbol in a symbol entry.
| table | Symbol table returned via mprCreateSymbolTable. |
Return the count of symbols in a symbol entry.
| table | Symbol table returned via mprCreateSymbolTable. |
Return the next symbol in a symbol entry.
| table | Symbol table returned via mprCreateSymbolTable. |
| last | Symbol table entry returned via mprGetFirstSymbol or mprGetNextSymbol. |
Convert hash keys to a single string.
| hash | Hash pointer returned from mprCreateHash. |
| join | String to use as the element join string. |
Convert a hash of strings to a single string.
| hash | Hash pointer returned from mprCreateHash. |
| join | String to use as the element join string. |
Lookup a symbol in the hash table.
| table | Symbol table returned via mprCreateSymbolTable. |
| key | String key of the symbole entry to delete. |
Lookup a symbol in the hash table and return the hash entry.
| table | Symbol table returned via mprCreateSymbolTable. |
| key | String key of the symbole entry to delete. |
Remove a symbol entry from the hash table.
| table | Symbol table returned via mprCreateSymbolTable. |
| key | String key of the symbole entry to delete. |
JSON Object.
| struct MprJson * | children | Children properties. | |
| int | length | Number of child properties. | |
| cchar * | name | Property name for this object. | |
| struct MprJson * | next | Next sibling. | |
| struct MprJson * | prev | Previous sibling. | |
| int | type | Property type. Object, Array or value. | |
| cchar * | value | Property value - always strings. |
Blend two JSON objects.
| dest | Parsed JSON object. This is the destination object. The "other" object will be blended into this object. |
| other | Parsed JSON object returned by mprJsonParser. |
| flags | Set to MPR_JSON_OVERWRITE to overwrite existing properties. |
Clone a JSON object.
Create a JSON object.
| type | Set JSON object type to MPR_JSON_OBJ for an object, MPR_JSON_ARRAY for an array or MPR_JSON_VALUE for a value. Note: all values are stored as strings. |
Deserialize a simple JSON string and return a hash of properties.
| str | JSON string. This must be an object with one-level of properties. |
Deserialize a simple JSON string into the given hash object.
| str | JSON string. This must be an object with one-level of properties. |
| hash | Destination MprHash object. |
Lookup a JSON object tree for a string key value.
| obj | Parsed JSON object returned by mprParseJson. |
| key | Property name to search for. This may include ".". For example: "settings.mode". See mprJsonQuery for a full description of key formats. |
| flags | Include MPR_JSON_SIMPLE for simple property names without embedded query expressions. Include MPR_JSON_TOP for properties at the top level (without embedded "."). |
Get the number of child properties in a JSON object.
| obj | Parsed JSON object returned by mprParseJson. |
Lookup a parsed JSON object for a key value.
| obj | Parsed JSON object returned by mprJsonParser. |
| key | Property name to search for. This may include ".". For example: "settings.mode". See mprJsonQuery for a full description of key formats. |
| flags | Include MPR_JSON_SIMPLE for simple property names without embedded query expressions. Include MPR_JSON_TOP for properties at the top level (without embedded "."). |
Convert a hash object into a JSON object.
| hash | MprHash object. |
Convert a JSON object into a Hash object.
| json | JSON object tree. |
Serialize a JSON object into a string.
| obj | Object returned via mprParseJson |
| flags | Serialization flags. Supported flags include MPR_JSON_PRETTY for a human-readable multiline format. MPR_JSON_QUOTES to wrap property names in quotes. Use MPR_JSON_STRINGS to emit all property values as quoted strings. |
Load a JSON object from a filename.
| path | Filename path containing a JSON string to load. |
Lookup a JSON object.
| obj | Parsed JSON object returned by mprParseJson. |
| name | Name of the property to lookup. |
Lookup a JSON object.
| obj | Parsed JSON object returned by mprParseJson. |
| name | Name of the property to lookup. |
Parse a JSON string into an object tree.
| str | JSON string to deserialize. |
Extended JSON parsing from a JSON string into an object tree.
| str | JSON string to deserialize. This is an unmanaged reference. i.e. it will not be marked by the garbage collector. |
| callback | Callback functions. This is an instance of the MprJsonCallback structure. |
| data | Opaque object to pass to the given callbacks. This is an unmanaged reference. |
| obj | Optional object to serialize into. |
| errorMsg | Error message if the string fails to parse. |
Parse a JSON string into an existing object.
| str | JSON string to deserialize. |
| obj | JSON object to store parsed properties from str. |
Query a parsed JSON object for a key value.
| obj | Parsed JSON object returned by mprParseJson. |
| key | Property name to search for. The property key may be a multipart property and may include . [] and ... substrings. For example: "settings.mode", "colors[2], users...name". The "." and "[]" operator reference sub-properties. The "..." elipsis operator spans zero or more objects levels. \ Inside the [] operator, you may include an expression to select qualifying properties. The expression is of the form: field OP value, where field is the name of the property, OP is ==, !=, <=, >= or ~. The latter being a simple string pattern match (contains). To compare the field iself, use "@". This is useful to compare array element values. For example: colors[@ == 'red']. |
| flags | Include MPR_JSON_SIMPLE for simple property names without embedded query expressions. Include MPR_JSON_TOP for properties at the top level (without embedded "."). Include MPR_JSON_DUPLICATE to permit duplicate values with the same property name. |
Remove a property from a JSON object.
| obj | Parsed JSON object returned by mprParseJson. |
| key | Property name to remove for. This may include ".". For example: "settings.mode". See mprJsonQuery for a full description of key formats. |
Remove a child from a JSON object.
| obj | Parsed JSON object returned by mprParseJson. |
| child | JSON child to remove. |
Save a JSON object to a filename.
| obj | Parsed JSON object returned by mprParseJson. |
| path | Filename path to contain the saved JSON string. |
| flags | Same flags as for mprJsonToString: MPR_JSON_PRETTY, MPR_JSON_QUOTES, MPR_JSON_STRINGS. |
Serialize a hash of properties as a JSON string.
| hash | Hash of properties to examine. |
| flags | Serialization flags. Supported flags include MPR_JSON_PRETTY for a human-readable multiline format. MPR_JSON_QUOTES to wrap property names in quotes. Use MPR_JSON_STRINGS to emit all property values as quoted strings. |
Update a key/value in the JSON object with a string value.
| obj | Parsed JSON object returned by mprParseJson. |
| key | Property name to add/update. This may include ".". For example: "settings.mode". See mprJsonQuery for a full description of key formats. |
| flags | Include MPR_JSON_SIMPLE for simple property names without embedded query expressions. Include MPR_JSON_TOP for properties at the top level (without embedded "."). Include MPR_JSON_DUPLICATE to permit duplicate values with the same property name. |
| value | Character string value. |
Signal a parse error in the JSON input stream.
| jp | JSON control structure. |
| fmt | Printf style format string. |
| ... | Printf arguments. |
Update a property in a JSON object.
| obj | Parsed JSON object returned by mprParseJson. |
| key | Property name to add/update. This may include ".". For example: "settings.mode". See mprJsonQuery for a full description of key formats. |
| value | Property value to set. |
| flags | Include MPR_JSON_SIMPLE for simple property names without embedded query expressions. Include MPR_JSON_TOP for properties at the top level (without embedded "."). Include MPR_JSON_DUPLICATE to permit duplicate values with the same property name. |
Trace the JSON object to the debug log.
| level | Debug trace level. |
| obj | Object to trace. |
List data structure.
| int | flags | Control flags. | |
| void ** | items | List item data. | |
| int | length | Current length of the list contents. | |
| int | maxSize | Maximum capacity. | |
| MprMutex * | mutex | Multithread lock. | |
| int | size | Current list capacity. |
Add an item to a list.
| list | List pointer returned from mprCreateList |
| item | Pointer to item to store. |
Add a null item to the list.
Append a list.
| list | List pointer returned from mprCreateList |
| add | List whose contents are added. |
Clears the list of all items.
| list | List pointer returned from mprCreateList. |
Clone a list and all elements.
| src | Source list to copy. |
Copy list contents.
| dest | Destination list for the copy. |
| src | Source list. |
Create a key / value pair.
| key | Key string. |
| value | Key value string. |
| flags | Flags value. |
Create a list.
| size | Initial capacity of the list. Set to < 0 to get a growable list with a default initial size. Set to 0 to to create the list but without any initial list storage. Then call mprSetListLimits to define the initial and maximum list size. |
| flags | Control flags. Possible values are: MPR_LIST_STATIC_VALUES to indicate list items are static and should not be marked for GC. MPR_LIST_STABLE to create an optimized list for private use that is not thread-safe. |
Create a list of words.
| str | String containing white space or comma separated words. |
Get the first item in the list.
| list | List pointer returned from mprCreateList. |
Get an list item.
| list | List pointer returned from mprCreateList. |
| index | Item index into the list. Indexes have a range from zero to the lenghth of the list - 1. |
Get the last item in the list.
| list | List pointer returned from mprCreateList. |
Get the current capacity of the list.
| list | List pointer returned from mprCreateList. |
Get the number of items in the list.
| list | List pointer returned from mprCreateList. |
Get the next item in the list.
| list | List pointer returned from mprCreateList. |
| lastIndex | Pointer to an integer that will hold the last index retrieved. |
Get the next item in a stable list.
This is an optimized version of mprGetNextItem| list | List pointer returned from mprCreateList. |
| lastIndex | Pointer to an integer that will hold the last index retrieved. |
Get the previous item in the list.
| list | List pointer returned from mprCreateList. |
| lastIndex | Pointer to an integer that will hold the last index retrieved. |
Initialize a list structure.
| list | Reference to the MprList struct. |
| flags | Control flags. Possible values are: MPR_LIST_STATIC_VALUES to indicate list items are static and should not be marked for GC. MPR_LIST_STABLE to create an optimized list for private use that is not thread-safe. |
Insert an item into a list at a specific position.
| list | List pointer returned from mprCreateList |
| index | Location at which to store the item. The previous item at this index is moved up to make room. |
| item | Pointer to item to store. |
Convert a list of strings to a single string.
This uses the specified join string between the elements| list | List pointer returned from mprCreateList. |
| join | String to use as the element join string. May be null. |
Find an item and return its index.
| list | List pointer returned from mprCreateList. |
| item | Pointer to value stored in the list. |
Find a string item and return its index.
| list | List pointer returned from mprCreateList. |
| str | Pointer to string to look for. |
Pop an item.
| list | List pointer returned from mprCreateList. |
Push an item onto the list.
| list | List pointer returned from mprCreateList. |
| item | Item to push onto the list. |
Remove an item from the list.
| list | List pointer returned from mprCreateList. |
| item | Item pointer to remove. |
Remove an item from the list.
Remove the last item from the list.
| list | List pointer returned from mprCreateList. |
Remove a range of items from the list.
| list | List pointer returned from mprCreateList. |
| start | Starting item index to remove (inclusive). |
| end | Ending item index to remove (inclusive). |
Remove a string item from the list.
| list | List pointer returned from mprCreateList. |
| str | String value to remove. |
Set a list item.
| list | List pointer returned from mprCreateList. |
| index | Location to update. |
| item | Pointer to item to store. |
Define the list size limits.
| list | List pointer returned from mprCreateList. |
| initialSize | Initial size for the list. This call will allocate space for at least this number of items. |
| maxSize | Set the maximum limit the list can grow to become. |
Quicksort.
| base | Base of array to sort. |
| num | Number of array elements. |
| width | Width of array elements. |
| compare | Comparison function. |
| ctx | Context argument to provide to comparison function. |
Sort a list.
| list | List pointer returned from mprCreateList. |
| compare | Comparison function. If null, then a default string comparison is used. |
| ctx | Context to provide to comparison function. |
Logging Services.
Output an assure assertion failed message.
| loc | Source code location string. Use MPR_LOC to define a file name and line number string suitable for this parameter. |
| msg | Simple string message to output. |
Backup a log.
| path | Base log filename. |
| count | Count of archived logs to keep. |
Initialize the log service.
Log an error message.
| fmt | Printf style format string. Variable number of arguments to. |
| ... | Variable number of arguments for printf data. |
Log a fatal error message and exit.
| fmt | Printf style format string. Variable number of arguments to. |
| ... | Variable number of arguments for printf data. |
Get the log file object.
Get the current MPR debug log handler.
Log an informational message.
| fmt | Printf style format string. Variable number of arguments to. |
| ... | Variable number of arguments for printf data. |
Write a message to the log file.
| level | Logging level for this message. The level is 0-9 with zero being the most verbose. |
| fmt | Printf style format string. Variable number of arguments to. |
| ... | Variable number of arguments for printf data. |
Emit a descriptive log header.
Write a raw log message to the diagnostic log file.
| level | Logging level for this message. The level is 0-9 with zero being the most verbose. |
| fmt | Printf style format string. Variable number of arguments to. |
| ... | Variable number of arguments for printf data. |
Set the log rotation parameters.
| logSize | If the size is zero, then the log file will be rotated on each application boot. Otherwise, the log file will be rotated if on application boot, the log file is larger than this size. |
| backupCount | Count of the number of log files to keep. |
| flags | Set to MPR_LOG_APPEND to append to existing log files. Set to MPR_LOG_TRUNCATE to truncate log files on application restart. |
Set the current logging level.
| level | New logging level. Must be 0-9 inclusive. |
Start logging.
| logSpec | Set the log file name and level. The format is "pathName[:level]". The following levels are generally observed:
|
| showConfig | Set to true to log an initial system configuration. |
Write a trace message to the diagnostic log file.
| level | Logging level for this message. The level is 0-9 with zero being the most verbose. |
| fmt | Printf style format string. Variable number of arguments to. |
| ... | Variable number of arguments for printf data. |
Determine if the app is using the default MPR log handler.
Log a warning message.
| fmt | Printf style format string. Variable number of arguments to. |
| ... | Variable number of arguments for printf data. |
Memory Allocation Service.
| uchar | eternal | Immune from GC. Implemented as a byte to be atomic. | |
| uchar | first | Block is first block in region. | |
| uchar | free | Block not in use. | |
| uchar | fullRegion | Block is an entire region - never on free queues. | |
| uchar | hasManager | Has manager function. Set at block init. | |
| uchar | mark | GC mark indicator. Toggled for each GC pass by mark() when thread yielded. | |
| uchar | qindex | Freeq index. Always less than 512 queues. | |
| MprMemSize | size | Size in bytes. This is a 32-bit quantity on all systems unless BIT_MPR_ALLOC_BIG is defined and then it will be 64 bits. |
Add a memory block as a root for garbage collection.
| ptr | Any memory pointer. |
Allocate a block of memory.
| size | Size of the memory block to allocate. |
Allocate a block of memory.
| size | Size of the memory block to allocate. |
| flags | Allocation flags. Supported flags include: MPR_ALLOC_MANAGER to reserve room for a manager callback and MPR_ALLOC_ZERO to zero allocated memory. |
Allocate an object of a given type.
| type | Type of the object to allocate. |
| manager | Manager function to invoke when the allocation is managed. |
Allocate a zeroed block of memory.
| size | Size of the memory block to allocate. |
Create and initialize the Memory service.
| manager | Memory manager to manage the Mpr object. |
| flags | Memory initialization control flags. |
Enable or disable the garbage collector.
| on | Set to one to enable and zero to disable. |
Collect garbage.
| flags | Flags to control the collection. Set flags to MPR_GC_FORCE to force a collection. Set to MPR_GC_DEFAULT to perform a conditional sweep where the sweep is only performed if there is sufficient garbage to warrant a collection. Set to MPR_GC_NO_BLOCK to run GC if necessary and return without yielding. Use MPR_GC_COMPLETE to force a GC and wait until the GC cycle fully completes including the sweep phase. |
Get the allocated size of a memory block.
| ptr | Any memory allocated by mprAlloc. |
Return the amount of memory currently used by the application.
On Unix, this returns the total application memory size including code, stack, data and heap. On Windows, VxWorks and other operatings systems, it returns the amount of allocated heap memoryReturn the current allocation memory statistics block.
Get the current O/S virtual page size.
Determine if the MPR has encountered memory allocation errors.
Hold a memory block.
| ptr | Any memory block. |
Hold memory blocks.
| ptr | Any memory block. |
| ... | Other memory blocks. Terminate the list with a NULL. |
Test is a pointer is a valid memory context.
This is used to test if a block has been dynamically allocated| ptr | Any memory context allocated by mprAlloc or mprCreate. |
Compare two byte strings.
| b1 | Pointer to the first byte string. |
| b1Len | Length of the first byte string. |
| b2 | Pointer to the second byte string. |
| b2Len | Length of the second byte string. |
Safe copy for a block of data.
| dest | Pointer to the destination block. |
| destMax | Maximum size of the destination block. |
| src | Block to copy. |
| nbytes | Size of the source block. |
Duplicate a block of memory.
| ptr | Pointer to the block to duplicate. |
| size | Size of the block to copy. |
Pause the garbage collector.
Print a memory usage report to stdout.
| msg | Prefix message to the report. |
| flags | Set to MPR_MEM_DETAIL for a detailed memory report. |
Reallocate a block.
| ptr | Memory to reallocate. If NULL, call malloc. |
| size | New size of the required memory block. |
Release a memory block.
| ptr | Any memory block. |
Release a memory blocks.
| ptr | Any memory block. |
| ... | Other memory blocks. Terminate the list with a NULL. |
Remove a memory block as a root for garbage collection.
| ptr | Any memory pointer. |
Reset the memory allocation error flag.
Resume the garbage collector.
Update the manager for a block of memory.
| ptr | Memory to free. If NULL, take no action. |
| manager | Manager function to invoke when the memory is released. |
Set an memory allocation error condition on a memory context.
This will set an allocation error condition on the given context and all its parents. This way, you can test the ultimate parent and detect if any memory allocation errors have occurredConfigure the application memory limits.
| warnHeap | Soft memory limit. If exceeded, the request will be granted, but the memory handler will be invoked. to issue a warning and potentially take remedial acation. If -1, then do not update the warnHeap. |
| maximum | Hard memory limit. If exceeded, the request will not be granted, and the memory handler will be invoked. If -1, then do not update the maximum. |
| cache | Heap cache. Try to keep at least this amount of memory in the heap free queues If -1, then do not update the cache. |
Define a memory notifier.
| cback | Notifier callback function. |
Set the memory allocation policy for when allocations fail.
| policy | Set to MPR_ALLOC_POLICY_EXIT for the application to immediately exit on memory allocation errors. Set to MPR_ALLOC_POLICY_RESTART to restart the appplication on memory allocation errors. |
Memory virtual memory into the applications address space.
| size | of virtual memory to map. This size will be rounded up to the nearest page boundary. |
| mode | Mask set to MPR_MAP_READ | MPR_MAP_WRITE. |
Free (unpin) a mapped section of virtual memory.
| ptr | Virtual address to free. Should be page aligned. |
| size | Size of memory to free in bytes. |
Allocate a "permanent" block of memory that is not subject GC.
| size | Size of the memory block to allocate. |
Free a "permanent" block of memory allocated via "palloc".
| ptr | Pointer to the block. |
Reallocate a "permanent" block of memory allocated via "palloc".
| ptr | Pointer to the block. |
| size | New block size. |
Return the size of the block.
This may be larger than what was originally requested| ptr | Pointer to the block. |
Mime Type hash table entry (the URL extension is the key).
| char * | program | Mime type string. | |
| char * | type | Mime type string. |
Add a mime type to the mime type table.
| table | type hash table returned by mprCreateMimeTypes |
| ext | Filename extension to use as a key for the given mime type. |
| mimeType | Mime type string to associate with the ext key. |
Create the mime types.
| path | Filename of a mime types definition file. |
Get the mime type program for a given mimeType.
| table | type hash table returned by mprCreateMimeTypes |
| mimeType | Mime type to update. |
Get the mime type for an extension.
This call will return the mime type from a limited internal set of mime types for the given path or extension| table | Hash table of mime types to examine. |
| ext | Path or extension to examine. |
Set the mime type program.
| table | type hash table returned by mprCreateMimeTypes |
| mimeType | Mime type to update. |
| program | Program name to associate with this mime type. |
Loadable Module Service.
| char * | entry | Module library init entry point. | |
| int | flags | Module control flags. | |
| void * | handle | O/S shared library load handle. | |
| MprTicks | lastActivity | When the module was last used. | |
| MprTime | modified | When the module file was last modified. | |
| void * | moduleData | Module specific data - must be alloced data. | |
| char * | name | Unique module name. | |
| char * | path | Module library filename. | |
| MprModuleProc | start | Start the module. | |
| MprModuleProc | stop | Stop the module. Should be unloadable after stopping. | |
| MprTicks | timeout | Inactivity unload timeout. |
Create a module.
| name | Name of the module. |
| path | Optional filename of a module library to load. When loading, the filename will be searched using the defined module search path (see mprSetModuleSearchPath). The filename may or may not include a platform specific shared library extension such as .dll, .so or .dylib. By omitting the library extension, code can portably load shared libraries. |
| entry | Name of function to invoke after loading the module. |
| data | Arbitrary data pointer. This will be defined in MprModule.data and passed into the module initialization entry point. |
Get the module search path.
Load a module.
| mp | Module object created via mprCreateModule |
Load a native module.
| mp | Module object created via mprCreateModule |
Lookup a module.
| name | Name of the module specified to mprCreateModule |
Lookup a module and return the module data.
| name | Name of the module specified to mprCreateModule |
Search for a module on the current module path.
| module | Name of the module to locate. |
Define a module finalizer that will be called before a module is stopped.
| module | Module object to modify. |
| stop | Callback function to invoke before stopping the module. |
Set the module search path.
| searchPath | Colon separated set of directories. |
Set a module timeout.
| module | Module object to modify. |
| timeout | Inactivity timeout in milliseconds before unloading the module. |
Start a module.
| mp | Module object returned via mprLookupModule |
Stop a module.
| mp | Module object returned via mprLookupModule |
Unload a module.
| mp | Module object returned via mprLookupModule |
Unload a native module.
| mp | Module object created via mprCreateModule |
Loadable module service.
Path (filename) Information.
| MprTime | atime | Access time. | |
| bool | caseMatters | Case comparisons matter. | |
| int | checked | Path has been checked. | |
| MprTime | ctime | Create time. | |
| int | group | Group ID. | |
| int64 | inode | Inode number. | |
| bool | isDir | Set if directory. | |
| bool | isLink | Set if a symbolic link. | |
| bool | isReg | Set if a regular file. | |
| MprTime | mtime | Modified time. | |
| int | owner | Owner ID. | |
| int | perms | Permission mask. | |
| MprOff | size | File length. | |
| int | valid | Valid data bit. |
Copy a file.
| from | Path of the existing file to copy. |
| to | Name of the new file copy. |
| omode | Posix style file open mode mask. See mprOpenFile for the various modes. |
Delete a file.
| path | String containing the path to delete. |
Convert a path to an absolute path.
| path | Path to examine. |
Return the current working directory.
Get the first path separator in a path.
| path | Path to examine. |
Get a path formatted according to the native O/S conventions.
| path | Path name to examine. |
Get the base portion of a path.
| path | Path name to examine. |
Get a reference to the base portion of a path.
| path | Path name to examine. |
Get the directory portion of a path.
| path | Path name to examine. |
Get the file extension portion of a path.
| path | Path name to examine. |
Create a list of files in a directory or subdirectories.
This call returns a list of MprDirEntry objects| dir | Directory to list. |
| flags | The flags may be set to MPR_PATH_DESCEND to traverse subdirectories. Set MPR_PATH_NODIRS to exclude directories from the results. Set to MPR_PATH_HIDDEN to include hidden files that start with ".". Set to MPR_PATH_DEPTH_FIRST to do a depth-first traversal, i.e. traverse subdirectories before considering adding the directory to the list. |
Get the first directory portion of a path.
| path | Path name to examine. |
Return information about a file represented by a path.
| path | String containing the path to query. |
| info | Pointer to a pre-allocated MprPath structure. |
Get the target of a symbolic link.
| path | Path name to examine. |
Get the file newline character string for a given path.
Return the character string used to delimit new lines in text files| path | Use this path to specify either the root of the file system or a file on the file system. |
Get the parent directory of a path.
| path | Path name to examine. |
Get the default path directory separator.
Return the default directory separator character used to separate directories on a given file system. Typically "/" or "\"| path | Use this path to specify either the root of the file system or a file on the file system. |
Get the path directory separator.
Return the directory separator characters used to separate directories on a given file system. Typically "/" or "\" The first entry is the default separator| path | Use this path to specify either the root of the file system or a file on the file system. |
Get a portable path.
| path | Path name to examine. |
Get a relative path.
| dest | Destination file. |
| origin | Starting location from which to compute a relative path to the destination If the origin is null, use the application's current working directory as the origin. |
Make a temporary file.
| tmpDir | Base directory in which the temp file will be allocated. |
Convert a path to an absolute windows path.
| path | Path to examine. |
Create a list of files in a directory or subdirectories that match the given wildcard patterns.
This call returns a list of filenames| path | Directory to list. |
| patterns | Wild card patterns to match. |
| flags | The flags may be set to MPR_PATH_DESCEND to traverse subdirectories. Set MPR_PATH_NODIRS to exclude directories from the results. Set to MPR_PATH_HIDDEN to include hidden files that start with ".". Set to MPR_PATH_DEPTH_FIRST to do a depth-first traversal, i.e. traverse subdirectories before considering adding the directory to the list. |
Fast version of mprIsPathContained that works only for absolute paths.
Determine if a directory is the same as or a parent of a path| path | Path name to examine. |
| dir | Directory to examine if it is a parent of path or equal to path. |
Determine if a path is absolute.
| path | Path name to examine. |
Determine if a directory is the same as or a parent of a path.
| dir | Directory to examine if it is a parent of path. |
| path | Path name to examine. |
Determine if a path is a directory.
| path | Path name to examine. |
Determine if a path is relative.
| path | Path name to examine. |
Test if a character is a path separarator.
| path | Path name to identify the file system. |
| c | Character to test. |
Join paths.
| base | Directory path name to use as the base. |
| path | Other path name to join to the base path. |
Join an extension to a path.
| path | Path name to use as a base. Path is not modified. |
| ext | Extension to add. Must should not have a period prefix. |
Join paths.
| base | Directory path name to use as the base. |
| ... | Other paths to join to the base path. List of other paths must be NULL terminated. |
Make a directory.
| path | String containing the directory pathname to create. |
| makeMissing | If true make all required intervening directory segments. |
| perms | Posix style file permissions mask. |
| owner | User to own the directory. Set to -1 not change the owner. |
| group | Group to own the directory. Set to -1 not change the group. |
Make a link.
| path | String containing the path to link to. |
| target | String containing the new link path to be created. |
| hard | If true, make a hard link, otherwise make a soft link. |
Map the separators in a path.
| path | Path name to examine. |
| separator | Separator character to use. |
Normalize a path.
| path | First path to compare. |
Determine if a file exists for a path name and can be accessed.
| path | Path name to test. |
| omode | Posix style file open mode mask. See mprOpenFile for the various modes. |
Replace an extension to a path.
| dir | Directory path name to test use as the base/dir. |
| ext | Extension to add. The extension should not have a period prefix. |
Resolve paths.
| base | Base path to use as the base. |
| path | Path name to resolve against base. |
Compare two paths if they are the same.
| path1 | First path to compare. |
| path2 | Second path to compare. |
Compare two paths if they are the same for a given length.
| path1 | First path to compare. |
| path2 | Second path to compare. |
| len | How many characters to compare. |
Search for a path.
| path | Path name to locate. Must be an existing file or directory. |
| flags | Flags. |
| search | Variable number of directories to search. |
Transform a path.
| path | First path to compare. |
| flags | Flags to modify the path representation. |
Trim path components from a path.
| path | Path to examine. |
| count | Number of components to trim. If negative, trim from the end. |
Trim the drive from a path.
| path | Path to examine. |
Trim an extension from a path.
| path | Path to examine. |
Create a file and write contents.
| path | Filename to create. |
| buf | Buffer of data to write to the file. |
| len | Size of the buf parameter in bytes. |
| mode | File permissions with which to create the file. E.g. 0644. |
Signal control structure.
| void * | data | Handler data. | |
| MprDispatcher * | dispatcher | Dispatcher to service handler. | |
| int | flags | Control flags. | |
| MprSignalProc | handler | Signal handler (non-native). | |
| struct MprSignal * | next | Chain of handlers on the same signo. | |
| void(* | sigaction)() | Prior sigaction handler. | |
| int | signo | Signal number. |
Add a signal handler.
The signal handling mechanism will trap the specified signal if issued and create an event on the given dispatcher. This will cause the handler function to be safely run by the dispatcher. Normally, signal handlers are difficult to write as the code must be Async-safe. This API permits the use of common, single-threaded code to be used for signal handlers without worrying about pre-emption by other signals or threads| signo | Signal number to handle. |
| handler | Call back procedure to invoke. This has the signature MprSignalProc |
| arg | Argument to provide to the handler. |
| dispatcher | Event dispatcher on which to queue an event to run the handler. |
| flags | Set to either MPR_SIGNAL_BEFORE or MPR_SIGNAL_AFTER to run the handler before/after existing handlers. |
Add standard trapping of system signals.
The trapped signals are SIGINT, SIGQUIT, SIGTERM, SIGPIPE and SIGXFSZ. SIGPIPE and SIGXFSZ are ignored. A shutdown is initiated for SIGTERM whereas SIGINT and SIGQUIT will do an abortive exit. SIGUSR1 will do an in-process restartSocket Service.
| char * | acceptIp | Server addresss that accepted a new connection (actual interface). | |
| int | acceptPort | Server port doing the listening. | |
| char * | errorMsg | Connection related error messages. | |
| Socket | fd | Actual socket file handle. | |
| int | flags | Current state flags. | |
| MprWaitHandler * | handler | Wait handler. | |
| char * | ip | Server listen address or remote client address. | |
| struct MprSocket * | listenSock | Listening socket. | |
| MprMutex * | mutex | Multi-thread sync. | |
| int | port | Port to listen or connect on. | |
| MprSocketProvider * | provider | Socket implementation provider. | |
| MprSocketService * | service | Socket service. | |
| struct MprSsl * | ssl | SSL configuration. | |
| void * | sslSocket | Extended SSL socket state. |
Accept an incoming connection.
| listen | Listening server socket. |
Add a wait handler to a socket.
| sp | Socket object created via mprCreateSocket. |
| mask | Mask of events of interest. This is made by oring MPR_READABLE and MPR_WRITABLE. |
| dispatcher | Dispatcher object to use for scheduling the I/O event. |
| proc | Callback function to invoke when an I/O event of interest has occurred. |
| data | Data item to pass to the callback. |
| flags | Socket handler flags. |
Add a secure socket provider for SSL communications.
| name | Name of the secure socket provider. |
| provider | Socket provider object. |
Clone a socket object.
Close a socket.
| sp | Socket object returned from mprCreateSocket |
| graceful | Set to true to do a graceful close. Otherwise, an abortive close will be performed. |
Connect a client socket.
| sp | Socket object returned via mprCreateSocket |
| ip | Host or IP address to connect to. |
| port | TCP/IP port number to connect to. |
| flags | Socket flags may use the following flags ored together:
|
Create a socket.
Disconnect a socket by closing its underlying file descriptor.
This is used to prevent further I/O wait events while still preserving the socket object| sp | Socket object. |
Enable socket events for a socket callback.
| sp | Socket object returned from mprCreateSocket |
| mask | Mask of events to enable. |
Flush a socket.
| sp | Socket object returned from mprCreateSocket |
Get the socket blocking mode.
| sp | Socket object returned from mprCreateSocket |
Get a socket error code.
| sp | Socket object returned from mprCreateSocket |
Get the socket file descriptor.
| sp | Socket object returned from mprCreateSocket |
Get the socket for an IP:Port address.
| ip | IP address or hostname. |
| port | Port number. |
| family | Output parameter to contain the Internet protocol family. |
| protocol | Output parameter to contain the Internet TCP/IP protocol. |
| addr | Output parameter to contain the sockaddr description of the socket address. |
| addrlen | Output parameter to hold the length of the sockaddr object. |
Get the port used by a socket.
| sp | Socket object returned from mprCreateSocket |
Get the socket state.
| sp | Socket object returned from mprCreateSocket |
has the system got a dual IPv4 + IPv6 network stack.
Determine if the system support IPv6.
Determine if SSL is available.
Determine if the IP address is an IPv6 address.
| ip | IP address. |
Test if the other end of the socket has been closed.
| sp | Socket object returned from mprCreateSocket |
Determine if the socket is secure.
| sp | Socket object returned from mprCreateSocket |
Listen on a server socket for incoming connections.
| sp | Socket object returned via mprCreateSocket |
| ip | IP address to bind to. Set to 0.0.0.0 to bind to all possible addresses on a given port. |
| port | TCP/IP port number to connect to. |
| flags | Socket flags may use the following flags ored together:
|
Parse an socket address IP address.
| address | An IP:PORT specification. The :PORT is optional. When an IP address contains an ipv6 port it should be written as aaaa:bbbb:cccc:dddd:eeee:ffff:gggg:hhhh:iiii or. |
| ip | Pointer to receive a dynamically allocated IP string. |
| port | Pointer to an integer to receive the port value. |
| secure | Pointer to an integer to receive true if the address requires SSL. |
| defaultPort | The default port number to use if the address does not contain a port. |
Read from a socket.
| sp | Socket object returned from mprCreateSocket |
| buf | Pointer to a buffer to hold the read data. |
| size | Size of the buffer. |
Remove a socket wait handler.
| sp | Socket object created via mprCreateSocket. |
Set the maximum number of accepted client connections that are permissable.
| max | New maximum number of accepted client connections. |
Set the socket blocking mode.
| sp | Socket object returned from mprCreateSocket |
| on | Set to zero to put the socket into non-blocking mode. Set to non-zero to enable blocking mode. |
Set the dispatcher to use for socket events.
| sp | Socket object returned from mprCreateSocket |
| dispatcher | Dispatcher object reference. |
Set an EOF condition on the socket.
| sp | Socket object returned from mprCreateSocket |
| eof | Set to true to set an EOF condition. Set to false to clear it. |
Set the socket delay mode.
| sp | Socket object returned from mprCreateSocket |
| on | Set to non-zero to put the socket into no delay mode. Set to zero to enable the nagle algorithm. |
Test if the socket is doing an SSL handshake.
| sp | Socket object returned from mprCreateSocket |
Test if the socket has buffered read data.
| sp | Socket object returned from mprCreateSocket |
Test if the socket has buffered write data.
| sp | Socket object returned from mprCreateSocket |
Steal the socket handle.
| sp | Socket object returned from mprCreateSocket |
Upgrade a socket to use SSL/TLS.
| sp | Socket to upgrade. |
| ssl | SSL configuration to use. Set to NULL to use the default. |
| peerName | Required peer name in handshake with peer. Used by clients to verify the server hostname. |
Write to a socket.
| sp | Socket object returned from mprCreateSocket |
| buf | Reference to a block to write to the socket. |
| len | Length of data to write. This may be less than the requested write length if the socket is in non-blocking mode. Will return a negative MPR error code on errors. |
Write to a string to a socket.
| sp | Socket object returned from mprCreateSocket |
| str | Null terminated string to write. |
Write a vector to a socket.
| sp | Socket object returned from mprCreateSocket |
| iovec | Vector of data to write before the file contents. |
| count | Count of entries in beforeVect. |
SSL control structure.
| char * | caFile | Certificate verification cert file or bundle. | |
| char * | caPath | Certificate verification cert directory (OpenSSL only). | |
| char * | certFile | Alternatively, locate the cert in a file. | |
| int | changed | Set if there is a change in the SSL config. Reset by providers. | |
| char * | ciphers | Candidate ciphers to use. | |
| void * | config | Extended provider SSL configuration. | |
| int | configured | Set if this SSL configuration has been processed. | |
| char * | key | Key string. | |
| char * | keyFile | Alternatively, locate the key in a file. | |
| MprMutex * | mutex | Multithread sync. | |
| int | protocols | SSL protocols. | |
| struct MprSocketProvider * | provider | Cached SSL provider to use. | |
| char * | providerName | SSL provider to use - null if default. | |
| int | verifyDepth | Set if the cert chain depth should be verified. | |
| int | verifyIssuer | Set if the certificate issuer should be also verified. | |
| int | verifyPeer | Verify the peer verificate. |
Add the ciphers to use for SSL.
| ssl | SSL instance returned from mprCreateSsl |
| ciphers | Cipher string to add to any existing ciphers. |
Create the a new SSL control structure based on an existing structure.
| src | Structure to clone. |
Create the SSL control structure.
| server | True if the SSL configuration will be used on the server side. |
Lookup an SSL cipher by its IANA name and return the cipher IANA code.
| cipher | Cipher IANA name. |
Lookup an SSL cipher by its IANA code and return the string name.
| cipher | Cipher IANA code. |
Load the SSL module.
Set the client certificate file to use for SSL.
| ssl | SSL instance returned from mprCreateSsl |
| caFile | Path to the SSL client certificate file. |
Set the path for the client certificate directory.
| ssl | SSL instance returned from mprCreateSsl |
| caPath | Path to the SSL client certificate directory. |
Set certificate to use for SSL.
| ssl | SSL instance returned from mprCreateSsl |
| certFile | Path to the SSL certificate file. |
Set the ciphers to use.
| ssl | SSL instance returned from mprCreateSsl |
| ciphers | String of suitable ciphers. |
Set the key file to use for SSL.
| ssl | SSL instance returned from mprCreateSsl |
| keyFile | Path to the SSL key file. |
Set the SSL protocol to use.
| ssl | SSL instance returned from mprCreateSsl |
| protocols | SSL protocols mask. |
Set the SSL provider to use.
| ssl | SSL instance returned from mprCreateSsl |
| provider | SSL provider name (openssl | matrixssl | est | nanossl). |
Control the depth of SSL SSL certificate verification.
| ssl | SSL instance returned from mprCreateSsl |
| depth | Set to the number of intermediate certificates to verify. Defaults to 1. |
Control the verification of SSL certificate issuers.
| ssl | SSL instance returned from mprCreateSsl |
| on | Set to true to enable SSL certificate issuer verification. |
Require verification of peer certificates.
| ssl | SSL instance returned from mprCreateSsl |
| on | Set to true to enable peer SSL certificate verification. |
Safe String Module.
Format a string into a static buffer.
| buf | Pointer to the buffer. |
| maxSize | Size of the buffer. |
| fmt | Printf style format string. |
| ... | Variable arguments to format. |
Format a string into a statically allocated buffer.
| buf | Pointer to the buffer. |
| maxSize | Size of the buffer. |
| fmt | Printf style format string. |
| args | Varargs argument obtained from va_start. |
Convert an integer to a string.
| value | Integer value to convert. |
Convert an integer to a string buffer.
| buf | Pointer to the buffer that will hold the string. |
| size | Size of the buffer. |
| value | Integer value to convert. |
| radix | The base radix to use when encoding the number. |
Convert an integer to a string.
| value | Integer value to convert. |
| radix | The base radix to use when encoding the number. |
Print a formatted message to the standard error channel.
| fmt | Printf style format string. |
| ... | Variable arguments to format. |
Print a formatted message to a file descriptor.
| file | MprFile object returned via mprOpenFile |
| fmt | Printf style format string. |
| ... | Variable arguments to format. |
Formatted print.
This is a secure verion of printf that can handle null args| fmt | Printf style format string. |
| ... | Variable arguments to format. |
Format a string into a buffer.
| buf | Optional buffer to contain the formatted result. |
| maxsize | Maximum size of the result. |
| fmt | Printf style format string. |
| args | Variable arguments to format. |
Create a camel case version of the string.
| str | Pointer to the block to duplicate. |
Compare strings ignoring case.
This is a safe replacement for strcasecmp. It can handle NULL args| s1 | First string to compare. |
| s2 | Second string to compare. |
Compare strings ignoring case.
This is similar to scaselesscmp but it returns a boolean| s1 | First string to compare. |
| s2 | Second string to compare. |
Find a character in a string.
| str | String to examine. |
| c | Character to search for. |
Clone a string.
| str | Pointer to the block to duplicate. |
Compare strings.
| s1 | First string to compare. |
| s2 | Second string to compare. |
Find a pattern in a string.
| str | Pointer to the string to search. |
| pattern | String pattern to search for. |
Copy a string.
| dest | Pointer to a pointer that will hold the address of the allocated block. |
| destMax | Maximum size of the target string in characters. |
| src | String to copy. |
Test if the string ends with a given pattern.
| str | String to examine. |
| suffix | Pattern to search for. |
Format a string.
This is a secure verion of printf that can handle null args| fmt | Printf style format string. |
| ... | Variable arguments for the format string. |
Format a string.
This is a secure verion of printf that can handle null args| fmt | Printf style format string. |
| args | Varargs argument obtained from va_start. |
Compute a hash code for a string.
| str | String to examine. |
| len | Length in characters of the string to include in the hash code. |
Compute a caseless hash code for a string.
| str | String to examine. |
| len | Length in characters of the string to include in the hash code. |
Catenate strings.
| str | First string to catentate. |
| ... | Variable number of string arguments to append. Terminate list with NULL. |
Catenate strings.
| str | First string to catentate. |
| args | Varargs argument obtained from va_start. |
Return the length of a string.
| str | String to measure. |
Convert a string to lower case.
| str | String to convert. |
Compare strings.
| s1 | First string to compare. |
| s2 | Second string to compare. |
Compare strings ignoring case.
| s1 | First string to compare. |
| s2 | Second string to compare. |
| len | Length of characters to compare. |
Clone a substring.
| str | Pointer to the block to duplicate. |
| len | Number of bytes to copy. The actual length copied is the minimum of the given length and the length of the supplied string. The result is null terminated. |
Compare strings.
| s1 | First string to compare. |
| s2 | Second string to compare. |
| len | Length of characters to compare. |
Find a pattern in a string with a limit.
| str | Pointer to the string to search. |
| pattern | String pattern to search for. |
| limit | Count of characters in the string to search. |
Copy characters from a string.
| dest | Pointer to a pointer that will hold the address of the allocated block. |
| destMax | Maximum size of the target string in characters. |
| src | String to copy. |
| len | Maximum count of characters to copy. |
Locate the a character in a string.
| str | String to examine. |
| set | Set of characters to scan for. |
Find a character in a string by searching backwards.
| str | String to examine. |
| c | Character to scan for. |
Append strings to an existing string and reallocate as required.
| buf | Existing (allocated) string to reallocate. May be null. May not be a string literal. |
| ... | Variable number of string arguments to append. Terminate list with NULL. |
Append strings to an existing string and reallocate as required.
| buf | Existing (allocated) string to reallocate. May be null. May not be a string literal. |
| args | Varargs argument obtained from va_start. |
Find the end of a spanning prefix.
| str | String to examine. |
| set | Set of characters to span. |
Test if the string starts with a given pattern.
| str | String to examine. |
| prefix | Pattern to search for. |
Create a substring.
| str | String to examine. |
| offset | Starting offset within str for the beginning of the substring. |
| length | Length of the substring in characters. |
Replace template tokens in a string with values from a lookup table.
Tokens are ${variable} references| str | String to expand. |
| tokens | Hash table of token values to use. |
Replace template tokens in a string with values from a lookup table.
Tokens are ${variable} references| str | String to expand. |
| tokens | Json object of token values to use. |
Create a Title Case version of the string.
| str | Pointer to the block to duplicate. |
Convert a string to a double.
| str | Pointer to the string to parse. |
Convert a string to an integer.
| str | Pointer to the string to parse. |
Convert a string to an integer.
| str | Pointer to the string to parse. |
| radix | Base to use when parsing the string. |
| err | Return error code. Set to 0 if successful. |
Tokenize a string.
| str | String to tokenize. |
| delim | Set of characters that are used as token separators. |
| last | Last token pointer. |
String to list.
This parses the string into space separated arguments. Single and double quotes are supported| src | Source string to parse. |
Trim a string.
| str | String to trim. |
| set | String of characters to remove. |
| where | Flags to indicate trim from the start, end or both. Use MPR_TRIM_START, MPR_TRIM_END, MPR_TRIM_BOTH. |
Convert a string to upper case.
| str | String to convert. |
Multithreaded Synchronization Services.
Atomic Add.
This is a lock free function| target | Address of the target word to add to. |
| value | Value to add to the target. |
Atomic 64 bit Add.
This is a lock free function| target | Address of the target word to add to. |
| value | Value to add to the target. |
Apply a full (read+write) memory barrier.
Atomic Compare and Swap.
This is a lock free function| target | Address of the target word to swap. |
| expected | Expected value of the target. |
| value | New value to store at the target. |
Atomic list insertion.
Inserts "item" at the "head" of the list. The "link" field is the next field in item. This is a lock-free function| head | list head. |
| link | Reference to the list head link field. |
| item | Item to insert. |
Open and initialize the atomic subystem.
Create a condition lock variable.
Create a Mutex lock object.
Create a spin lock lock object.
Globally lock the application.
Unlock the global mutex.
Initialize a statically allocated Mutex lock object.
| mutex | Reference to an MprMutex structure to initialize. |
Initialize a statically allocated spinlock object.
| lock | Reference to a static MprSpin object. |
Lock access.
Reset a condition variable.
This sets the condition variable to the unsignalled condition| cond | Condition variable object created via mprCreateCond |
Signal a condition lock variable.
| cond | Condition variable object created via mprCreateCond |
Signal a condition lock variable for use with multiple waiters.
| cond | Condition variable object created via mprCreateCond |
Lock a spinlock.
Unlock a spinlock.
Attempt to lock access.
Attempt to lock access on a spin lock.
Unlock a mutex.
Wait for a condition lock variable.
| cond | Condition variable object created via mprCreateCond |
| timeout | Time in milliseconds to wait for the condition variable to be signaled. |
Wait for a condition lock variable for use with multiple waiters.
| cond | Condition variable object created via mprCreateCond |
| timeout | Time in milliseconds to wait for the condition variable to be signaled. |
Test service facility.
| int | activeThreadCount | Currently active test threads. | |
| int | argc | Count of arguments. | |
| char ** | argv | Arguments for test (not alloced). | |
| bool | continueOnFailures | Keep testing on failures. | |
| bool | debugOnFailures | Break to the debugger. | |
| int | echoCmdLine | Echo the command line. | |
| int | firstArg | Count of arguments. | |
| MprList * | groups | Master list of test groups. | |
| int | iterations | Times to run the test. | |
| MprMutex * | mutex | Multi-thread sync. | |
| cchar * | name | Name for entire test. | |
| int | numThreads | Number of test threads. | |
| bool | singleStep | Pause between tests. | |
| MprTime | start | When testing began. | |
| int | testDepth | Depth of entire test. | |
| MprList * | testFilter | Test groups to run. | |
| MprList * | threadData | Per thread objects. | |
| int | totalFailedCount | Total count of failing tests. | |
| int | totalTestCount | Total count of all tests. | |
| int | verbose | Output activity trace. | |
| int | workers | Count of worker threads. |
Test assert.
| gp | Test group reference. |
| loc | Program location string including filename and line number. |
| success | Boolean indicating whether the test passed or failed. |
| msg | Message to display if the test failed. |
Add a test group to the test service.
| ts | Test service object returned from mprCreateTestService |
| def | Test group definition to add. |
Create the test service.
Parse test command arguments.
| ts | Test service object returned from mprCreateTestService |
| argc | Count of arguments in argv. |
| argv | Argument array. |
| extraParser | Callback function to invoke to parse non-standard arguments. |
Report the test results.
| ts | Test service object returned from mprCreateTestService |
Reset a test group.
| gp | Test group reference. |
Run the define unit tests.
| ts | Test service object returned from mprCreateTestService |
Signal a test is complete.
| gp | Test group reference. |
Signal a test is complete.
| gp | Test group reference. |
Wait for a test to complete.
| gp | Test group reference. |
| timeout | Timeout in milliseconds to block waiting for the test to complete. |
Wait for a test to complete.
| gp | Test group reference. |
| timeout | Timeout in milliseconds to block waiting for the test to complete. |
Thread Service.
| MprCond * | cond | Multi-thread synchronization. | |
| void * | data | Data argument. | |
| MprThreadProc | entry | Users thread entry point. | |
| int | isMain | Is the main thread. | |
| MprMutex * | mutex | Multi-thread locking. | |
| char * | name | Name of thead for trace. | |
| MprOsThread | osThread | O/S thread id. | |
| ulong | pid | Owning process id. | |
| int | priority | Current priority. | |
| ssize | stackSize | Only VxWorks implements. | |
| int | stickyYield | Yielded does not auto-clear after GC. | |
| int | waitForSweeper | Yield untill the GC sweeper is complete. | |
| int | waiting | Waiting in mprYield. | |
| int | yielded | Thread has yielded to GC. |
Create a new thread.
| name | Unique name to give the thread. |
| proc | Entry point function for the thread. mprStartThread will invoke this function to start the thread. |
| data | Thread private data stored in MprThread.data. |
| stackSize | Stack size to use for the thread. On VM based systems, increasing this value, does not necessarily incurr a real memory (working-set) increase. Set to zero for a default stack size. |
Get the O/S thread.
Get the currently executing thread.
Get the thread name.
| thread | Thread object returned from mprCreateThread |
Get the thread priroity.
| thread | Thread object returned by mprCreateThread |
Set the thread priroity for the current thread.
| priority | Priority to associate with the thread. Mpr thread priorities are are integer values between 0 and 100 inclusive with 50 being a normal priority. The MPR maps these priorities in a linear fashion onto native O/S priorites. Useful constants are:
|
Set the thread priroity.
| thread | Thread object returned by mprCreateThread |
| priority | Priority to associate with the thread. Mpr thread priorities are are integer values between 0 and 100 inclusive with 50 being a normal priority. The MPR maps these priorities in a linear fashion onto native O/S priorites. Useful constants are:
|
Start a thread.
| thread | Thread object returned from mprCreateThread |
Date and Time Service.
Compare two times.
| t1 | First time. |
| t2 | Second time. |
Mpr time structure.
Decode a time value into a tokenized local time value.
| timep | Pointer to a tm structure to hold the result. |
| time | Time to format. |
Decode a time value into a tokenized UTC time structure.
| timep | Pointer to a tm structure to hold the result. |
| time | The time to format. |
Convert a time value to local time and format as a string.
| fmt | Time format string. See mprFormatUniversalTime for time formats. |
| time | Time to format. Use mprGetTime to retrieve the current time. |
Format a time value as a local time.
| fmt | The time format to use. See mprFormatUniversalTime for time formats. |
| timep | The time value to format. |
Convert a time value to universal time and format as a string.
\par \b Description: Format a time string. This uses strftime if available and so the supported formats vary from platform to platform. Strftime should supports some of these these formats described below| fmt | Time format string A ... full weekday name (Monday) a ... abbreviated weekday name (Mon) B ... full month name (January) b ... abbreviated month name (Jan) C ... century. Year / 100. (0-N) c ... standard date and time representation D ... date (m/d/y) d ... day-of-month (01-31) e ... day-of-month with a leading space if only one digit ( 1-31) F ... same as Y-m-d H ... hour (24 hour clock) (00-23) h ... same as b I ... hour (12 hour clock) (01-12) j ... day-of-year (001-366) k ... hour (24 hour clock) (0-23) l ... the hour (12-hour clock) as a decimal number (1-12); single digits are preceded by a blank. M ... minute (00-59) m ... month (01-12) n ... a newline P ... lower case am / pm p ... AM / PM R ... same as H:M r ... same as H:M:S p S ... second (00-59) s ... seconds since epoch T ... time (H:M:S) t ... a tab. U ... week-of-year, first day sunday (00-53) u ... the weekday (Monday as the first day of the week) as a decimal number (1-7). v ... is equivalent to ``e-b-Y''. W ... week-of-year, first day monday (00-53) w ... weekday (0-6, sunday is 0) X ... standard time representation x ... standard date representation Y ... year with century y ... year without century (00-99) Z ... timezone name z ... offset from UTC (-hhmm or +hhmm) %+ ... national representation of the date and time (the format is similar to that produced by date(1)). %% ... percent sign Some platforms may also support the following format extensions: E* ... POSIX locale extensions. Where "*" is one of the characters: c, C, x, X, y, Y. G ... a year as a decimal number with century. This year is the one that contains the greater part of the week (Monday as the first day of the week). g ... the same year as in ``G'', but as a decimal number without century (00-99). O* ... POSIX locale extensions. Where "*" is one of the characters: d, e, H, I, m, M, S, u, U, V, w, W, y. Additionly OB implemented to represent alternative months names (used standalone, without day mentioned). V ... the week number of the year (Monday as the first day of the week) as a decimal number (01-53). If the week containing January 1 has four or more days in the new year, then it is week 1; otherwise it is the last week of the previous year, and the next week is week 1. Useful formats: RFC822: "%a, %d %b %Y %H:%M:%S %Z "Fri, 07 Jan 2003 12:12:21 PDT" "%T %F "12:12:21 2007-01-03" "%v "07-Jul-2003" RFC3399: "%FT%TZ" "1985-04-12T23:20:50.52Z" |
| time | Time to format. Use mprGetTime to retrieve the current time. |
Get a string representation of the current date/time.
| fmt | Date formatting string. See strftime for acceptable date format specifiers. If null, then this routine uses the MPR_DEFAULT_DATE format. |
Get the elapsed time since a ticks mark.
Create the ticks mark with mprGetTicks()| mark | Starting time stamp. |
Get the elapsed time since a starting time mark.
| mark | Starting time created via mprGetTime() |
Return the time remaining until a timeout has elapsed.
| mark | Starting time stamp. |
| timeout | Time in milliseconds. |
Get the system time.
Get the time.
Get the current timezone offset for a given time.
| when | Time to examine to extract the timezone. |
Wait Handler Service.
| MprCond * | callbackComplete | Signalled when a callback is complete. | |
| int | desiredMask | Mask of desired events. | |
| MprDispatcher * | dispatcher | Event dispatcher to use for I/O events. | |
| MprEvent * | event | Event object to process I/O events. | |
| int | fd | O/S File descriptor (sp->sock). | |
| int | flags | Control flags. | |
| void * | handlerData | Argument to pass to proc - managed reference. | |
| int | notifierIndex | Index for notifier. | |
| int | presentMask | Mask of current events. | |
| MprEventProc | proc | Callback event procedure. | |
| struct MprWorker * | requiredWorker | Designate the required worker thread to run the callback. | |
| MprWaitService * | service | Wait service pointer. | |
| struct MprThread * | thread | Thread executing the callback, set even if worker is null. |
Internal.
Create a wait handler.
| fd | File descriptor. |
| mask | Mask of events of interest. This is made by oring MPR_READABLE and MPR_WRITABLE. |
| dispatcher | Dispatcher object to use for scheduling the I/O event. |
| proc | Callback function to invoke when an I/O event of interest has occurred. |
| data | Data item to pass to the callback. |
| flags | Wait handler flags. Use MPR_WAIT_NEW_DISPATCHER to auto-create a new dispatcher for each I/O event. |
Destroy a wait handler.
| wp | Wait handler object. |
Recall a wait handler.
| wp | Wait handler to recall. |
Recall a wait handler by fd.
| fd | File descriptor that matches that of a wait handler to recall. |
Remove a wait handler from the wait service.
| wp | Wait handler object. |
Wait for I/O.
| ws | Wait service object. |
| timeout | Timeout in milliseconds to wait for an event. |
Wait for I/O on a file descriptor.
No processing of the I/O event is done| fd | File descriptor to examine. |
| mask | Mask of events of interest (MPR_READABLE | MPR_WRITABLE). |
| timeout | Timeout in milliseconds to wait for an event. |
Subscribe for desired wait events.
| wp | Wait handler created via mprCreateWaitHandler |
| desiredMask | Mask of desired events (MPR_READABLE | MPR_WRITABLE). |
Worker thread structure.
| MprWorkerProc | cleanup | Procedure to cleanup after run before sleeping. | |
| void * | data | User per-worker data. | |
| MprCond * | idleCond | Used to wait for work. | |
| MprTicks | lastActivity | When the worker was last used. | |
| MprWorkerProc | proc | Procedure to run. | |
| int | running | Worker running a job. | |
| int | state | Worker state. | |
| MprThread * | thread | Thread associated with this worker. | |
| MprWorkerService * | workerService | Worker service. |
Get the count of available worker threads Return the count of free threads in the worker thread pool.
Dedicate a worker thread to a current real thread.
This implements thread affinity and is required on some platforms where some APIs (waitpid on uClibc) cannot be called on a different thread| worker | Worker object. |
| worker | Worker thread reference. |
Get the count of workers in the busy queue.
Get the worker object if the current thread is actually a worker thread.
Get the maximum count of worker pool threads Get the maximum limit of worker pool threads.
Get the Worker service statistics.
| stats | Reference to stats object to receive the stats. |
Set the maximum count of worker threads Set the maximum number of worker pool threads for the MPR.
If this number if less than the current number of threads, excess threads will be gracefully pruned as they exit| count | Maximum limit of threads to define. |
Set the minimum count of worker threads Set the count of threads the worker pool will have.
This will cause the worker pool to pre-create at least this many threads| count | Minimum count of threads to use. |
Set the default worker stack size.
| size | Stack size in bytes. |
Per XML session structure.
| char * | errMsg | Error message text. | |
| MprXmlHandler | handler | Callback function. | |
| MprBuf * | inBuf | Input data queue. | |
| void * | inputArg | Arg for mprXmlSetInputStream() | |
| int | lineNumber | Current line no for debug. | |
| void * | parseArg | Arg passed to mprXmlParse() | |
| int | quoteChar | XdbAtt quote char. | |
| MprXmlInputStream | readFn | Read data function. | |
| MprBuf * | tokBuf | Parsed token buffer. |
Get the XML error message if mprXmlParse fails.
| xp | XML parser instance returned from mprXmlOpen. |
Get the source XML line number.
| xp | XML parser instance returned from mprXmlOpen. |
Get the XML callback argument.
| xp | XML parser instance returned from mprXmlOpen. |
Open an XML parser instance.
| initialSize | Initialize size of XML in-memory token buffer. |
| maxSize | Maximum size of XML in-memory token buffer. Set to -1 unlimited. |
Run the XML parser.
| xp | XML parser instance returned from mprXmlOpen. |
Define the XML parser input stream.
This| xp | XML parser instance returned from mprXmlOpen. |
| fn | Callback function to provide data to the XML parser. The callback is invoked with the signature: ssize callbac(MprXml *xp, void *arg, char *buf, ssize size);. |
| arg | Callback argument to pass to the. |
Set the XML callback argument.
| xp | XML parser instance returned from mprXmlOpen. |
| parseArg | Argument to use for the callback. |
Set the XML parser data handle.
| xp | XML parser instance returned from mprXmlOpen. |
| h | Arbitrary data to associate with the parser. |
Clone a buffer.
| orig | Original buffer to copy. |
Clone a buffer contents.
| bp | Buffer to copy. |
Clone a buffer contents.
| bp | Buffer to copy. |
Initialize the cache service on startup.
Should only be called by the MPR init on startupCreate and initialize the module service.
Test if GC has been paused.
Return the name of the current thread.
Get the CPU tick count.
Indicate that the application layer has buffered data for the socket.
| sp | Socket object returned from mprCreateSocket |
| len | Length of buffered data in bytes. |
| dir | Buffer direction. Set to MPR_READABLE for buffered read data and MPR_WRITABLE for buffered write data. |
Test if a command is complete.
A command is complete when the child has exited and all command output and error output has been received| cmd | MprCmd object created via mprCreateCmd. |
Determine if the socket is using IPv6 Currently only works for server side addresses.
| sp | Socket object returned from mprCreateSocket |
Query a JSON object for a property key path and execute the given command.
The JSON object may be a string, array or object| obj | JSON object to examine. |
| keyPath | The keyPath is a multipart property string that specifies which property or properties to examine. Examples are:
user.name
user['name']
users[2]
users[2:4]
users[-4:-1] // Range from end of array
users[name == 'john']
users[age >= 50]
users[phone ~ ^206] // Starts with 206
users[*] // Set a new element
colors[@ != 'red'] // Array element not 'red'
people..[name == 'john'] // Elipsis descends down multiple levels
|
| value | If a value is provided, the property described by the keyPath is set to the value. |
| flags | If flags includes MPR_JSON_REMOVE, the property described by the keyPath is removed. If flags includes MPR_JSON_SIMPLE, the property is not parsed for expressions. Otherwise the the properties described by the keyPath are cloned and returned as a children of a container object. |
Mark a memory block as in-use.
| ptr | Reference to managed memory block. This must be managed memory allocated by the MPR. Do not call mprMark on memory allocated via malloc(), strdup() or other non-MPR allocation routines. It is safe pass a NULL pointer to mprMark and this will have no effect. This is a convenient pattern where manager functions can call mprMark() without testing if the element reference is null or not. |
Test if a thread should call mprYield.
Begin I/O notification services on a wait handler.
| wp | Wait handler associated with the file descriptor. |
| mask | Mask of events of interest. This is made by oring MPR_READABLE and MPR_WRITABLE. |
Queue an IO event for dispatch on the wait handler dispatcher.
| wp | Wait handler created via mprCreateWaitHandler |
Relay an event to a dispatcher.
This invokes the callback proc as though it was invoked from the given dispatcher| dispatcher | Dispatcher object created via mprCreateDispatcher |
| proc | Procedure to invoke. |
| data | Argument to proc. |
| event | Event object. |
Release a worker thread.
This releases a worker thread to be assignable to any real thread| worker | Worker object. |
| worker | Worker thread reference. |
Reset a sticky yield.
Set a file to be used for logging.
| file | MprFile object instance. |
Set an MPR debug log handler.
| handler | Callback handler. |
Start the module service.
Start a worker thread.
| proc | Worker procedure callback. |
| data | Data parameter to the callback. |
Stop the module service.
Signify to the garbage collector that the thread is ready for garbage collection.
| flags | Set to MPR_YIELD_WAIT to wait until the next collection is run. Set to MPR_YIELD_COMPLETE to wait until the garbage collection is fully complete including sweep phase. This is not normally required as the sweeper runs in parallel with user threads. Set to MPR_YIELD_STICKY to remain in the yielded state. This is useful when sleeping or blocking waiting for I/O. mprResetYield must be called after setting a sticky yield. |
Hashing function to use for the table.
| name | Name to hash. |
| len | Length of the name to hash. |
Signed file offset data type.
Supports large files greater than 4GB in size on all systemsElapsed time data type.
Stores time in milliseconds from some arbitrary start epochXML input stream function.
| xp | XML instance reference. |
| arg | to input stream. |
| buf | Buffer into which to read data. |
| size | Size of buf. |
Unsigned integral type.
Equivalent in size to void*Argument for sockets.
Service shutdown notifier.
| state | Current MPR state. Set to MPR_STARTED, MPR_STOPPING, MPR_STOPPED and MPR_DESTROYED |
| exitStrategy | Flags word including the flags: MPR_EXIT_ABORT, MPR_EXIT_RESTART and MPR_EXIT_SAFE. |
| status | The desired application exit status. |
Buffer refill callback function.
| buf | Instance of an MprBuf. |
| arg | Data argument supplied to mprSetBufRefillProc |
Cache item expiry callback.
| cache | Cache object. |
| key | Cached item key. |
| data | Cached item data. |
| event | Event of interest. |
Callback function before doing a fork().
Event callback function.
List comparison procedure for sorting.
| arg1 | First list item to compare. |
| arg2 | Second list item to compare. |
Quicksort callback function.
| p1 | Pointer to first element. |
| p2 | Pointer to second element. |
| ctx | Context argument to provide to comparison function. |
Log handler callback type.
| file | Source filename. Derived by using FILE |
| line | Source line number. Derived by using LINE |
| flags | Error flags. |
| level | Message logging level. Levels are 0-9 with zero being the most verbose. |
| msg | Message being logged. |
Mpr memory block manager prototype.
| ptr | Any memory context allocated by the MPR. |
Memory allocation error callback.
Notifiers are called if a low memory condition exists| cause | Set to the cause of the memory error. Set to MPR_MEM_WARNING if the allocation will exceed the warnHeap limit. Set to MPR_MEM_LIMIT if it would exceed the maxHeap memory limit. Set to MPR_MEM_FAIL if the allocation failed. Set to MPR_MEM_TOO_BIG if the allocation block size is too large. Allocations will be rejected for MPR_MEM_FAIL and MPR_MEM_TOO_BIG, otherwise the allocations will proceed and the memory notifier will be invoked. |
| policy | Memory depletion policy. Set to one of MPR_ALLOC_POLICY_NOTHING, MPR_ALLOC_POLICY_PRUNE, MPR_ALLOC_POLICY_RESTART or MPR_ALLOC_POLICY_EXIT |
| size | Size of the allocation that triggered the low memory condition. |
| total | Total memory currently in use. |
Loadable module entry point signature.
| data | Data passed to mprCreateModule. |
| mp | Module object reference returned from mprCreateModule |
Module start/stop point function signature.
| mp | Module object reference returned from mprCreateModule |
Signal callback procedure.
Callback before binding a socket.
Socket I/O callback procedure.
Proc returns non-zero if the socket has been deletedCallback parser for non-standard command line arguments.
Unit test callback procedure.
Thread main procedure.
| arg | Argument to the thread main. |
| tp | Thread instance reference. |
Worker thread callback signature.
| data | worker callback data. Set via mprStartWorker or mprActivateWorker. |
| worker | Reference to the worker thread object. |
XML callback handler.
| xp | XML instance reference. |
| state | XML state. |
| tagName | Current XML tag. |
| attName | Current XML attribute. |
| value | Current XML element value. |
Child status structure.
Command execution service.
Condition variable for single and multi-thread synchronization.
| pthread_cond_t | cv | Unix pthreads condition variable. | |
| struct MprMutex * | mutex | Thread synchronization mutex. | |
| int | triggered | Value of the condition. |
Directory entry description.
| bool | isDir | True if the file is a directory. | |
| bool | isLink | True if the file is a symbolic link. | |
| MprTime | lastModified | Time the file was last modified. | |
| char * | name | Name of the file. | |
| MprOff | size | Size of the file. |
Block structure when on a free list.
| struct MprFreeMem * | next | Next free block. | |
| struct MprFreeMem * | prev | Previous free block. |
Free queue head structure.
| MprMem | blk | Unused in queue head. | |
| uint | count | Number of blocks on the queue. | |
| MprSpin | lock | Queue lock-free lock. | |
| MprMemSize | minSize | Minimum size of blocks in queue. This is the user block size sans MprMem header. | |
| struct MprFreeMem * | next | Next free block. | |
| struct MprFreeMem * | prev | Previous free block. |
Hash table control structure.
| MprKey ** | buckets | Hash collision bucket table. | |
| int | flags | Hash control flags. | |
| MprHashProc | fn | Hash function. | |
| int | length | Number of symbols in the table. | |
| MprMutex * | mutex | GC marker sync. | |
| int | size | Size of the buckets array. |
Memory allocator heap.
| int | allocPolicy | Memory allocation depletion policy. | |
| int | collecting | Manual GC is running. | |
| int | compact | Next GC sweep should do a full compact. | |
| int | flags | GC operational control flags. | |
| int | freedBlocks | True if the last sweep freed blocks. | |
| MprFreeQueue | freeq[MPR_ALLOC_NUM_QUEUES] | Heap free queues. | |
| int | from | Eligible mprCollectGarbage flags. | |
| MprCond * | gcCond | GC sleep cond var. | |
| int | gcEnabled | GC is enabled. | |
| int | gcRequested | GC has been requested. | |
| int | hasError | Memory allocation error. | |
| int | iteration | GC iteration counter (debug only). | |
| int | mark | Mark version. | |
| int | marking | Actually marking objects now. | |
| int | mustYield | Threads must yield for GC which is due. | |
| int | nextSeqno | Next sequence number. | |
| MprMemNotifier | notifier | Memory allocation failure callback. | |
| int | pageSize | System page size. | |
| int | printStats | Print diagnostic heap statistics. | |
| uint64 | priorFree | Last sweep free memory. | |
| int | priorWeightedCount | Prior weighted count after last sweep. | |
| MprRegion * | regions | List of memory regions. | |
| int | regionSize | Memory allocation region size. | |
| struct MprList * | roots | List of GC root objects. | |
| int | scribble | Scribble over freed memory (slow). | |
| MprMemStats | stats | Memory allocation statistics. | |
| struct MprThread * | sweeper | GC sweeper thread. | |
| int | sweeping | Actually sweeping objects now. | |
| int | track | Track memory allocations (requires BIT_MPR_ALLOC_DEBUG). | |
| int | verify | Verify memory contents (very slow). | |
| int | workDone | Count of allocations weighted by block size. | |
| int | workQuota | Quota of work done before idle GC worthwhile. |
Vectored write array.
| ssize | len | Length of block to write. | |
| char * | start | Start of block to write. |
JSON parsing callbacks.
| int(* | checkBlock)(struct MprJsonParser *parser, cchar *name, bool leave) | Check state callback for JSON deserialization. This function is called at the entry and exit of object levels for arrays and objects. | |
| MprJson *(* | createObj)(struct MprJsonParser *parser, int type) | MakeObject callback for JSON deserialization. This function is called to construct an object for each level in the object tree. Objects will be either arrays or objects. | |
| bool(* | match)(struct MprJsonParser *parser, cchar *str, cchar *pattern) | Pattern matching callback. | |
| void(* | parseError)(struct MprJsonParser *parser, cchar *msg) | Handle a parse error. This function is called from mprSetJsonError to handle error reporting. | |
| int(* | setValue)(struct MprJsonParser *parser, MprJson *obj, cchar *name, MprJson *child) | Set a property value in an object. |
JSON parser.
Key value pairs for use with MprList or MprKey.
| int | flags | General flags word. | |
| void * | key | Key string. | |
| void * | value | Associated value for the key. |
Memory allocator statistics.
| uint64 | bytesAllocated | Bytes currently allocated. Includes active and free. | |
| uint64 | bytesFree | Bytes currently free and retained in the heap queues. | |
| uint64 | cacheHeap | Heap cache. Try to keep at least this amount in the free queues. | |
| uint64 | errors | Allocation errors. | |
| int | inMemException | Recursive protect. | |
| uint64 | lowHeap | Low memory level at which to initiate a collection. | |
| uint64 | maxHeap | Max memory that can be allocated. | |
| uint | numCpu | Number of CPUs. | |
| uint | pageSize | System page size. | |
| uint64 | ram | System RAM size in bytes. | |
| uint64 | rss | OS calculated resident stack size in bytes. | |
| uint64 | user | System user RAM size in bytes (excludes kernel). | |
| uint64 | warnHeap | Warn if heap size exceeds this level. |
Multithreading lock control structure.
A RomInode is created for each file in the Rom file system.
| uchar * | data | Pointer to file data. | |
| int | num | Inode number. | |
| char * | path | File path. | |
| int | size | Size of file. |
Per signal structure.
| int | triggered | Set to true when triggered. |
Signal service control.
| int | hasSignals | Signal sent to process. | |
| MprSignalInfo | info[MPR_MAX_SIGNALS] | Actual signal info and arg. | |
| MprMutex * | mutex | Multithread sync. | |
| struct sigaction | prior[MPR_MAX_SIGNALS] | Prior sigaction handler before hooking. | |
| MprSignal ** | signals | Signal handlers. | |
| MprList * | standard | Standard signal handlers. |
Socket service provider interface.
| void(* | closeSocket)(struct MprSocket *socket, bool graceful) |
Close a socket.
|
|
| void * | data | Socket provider private data. | |
| void(* | disconnectSocket)(struct MprSocket *socket) |
Disconnect a socket by closing its underlying file descriptor.
This is used to prevent further I/O wait events while still preserving the socket object. |
|
| ssize(* | flushSocket)(struct MprSocket *socket) |
Flush a socket.
|
|
| char * | name | Socket provider name. | |
| ssize(* | readSocket)(struct MprSocket *socket, void *buf, ssize size) |
Read from a socket.
|
|
| char *(* | socketState)(struct MprSocket *socket) |
Get the socket state.
|
|
| int(* | upgradeSocket)(struct MprSocket *socket, struct MprSsl *ssl, cchar *peerName) |
Upgrade a socket to use SSL/TLS.
|
|
| ssize(* | writeSocket)(struct MprSocket *socket, cvoid *buf, ssize size) |
Write to a socket.
|
Mpr socket service class.
| int | hasIPv6 | System has supoprt for IPv6. | |
| int | maxAccept | Maximum number of accepted client socket connections. | |
| MprMutex * | mutex | Multithread locking. | |
| int | numAccept | Count of client socket connections. | |
| MprSocketPrebind | prebind | Prebind callback. | |
| MprHash * | providers | Secure socket providers. | |
| MprList * | secureSockets | List of secured (matrixssl) sockets. | |
| char * | sslProvider | Default secure provider for SSL connections. | |
| MprSocketProvider * | standardProvider | Socket provider for non-SSL connections. |
Multithreading spin lock control structure.
Test case structure.
Test case definition.
Test failure record.
| char * | loc | Program location of the failure. | |
| char * | message | Failure message typically the assertion program text. |
A test group is a group of tests to cover a unit of functionality.
| MprList * | cases | List of tests in this group. | |
| struct HttpConn * | conn | Http connection for this group. | |
| char * | content | Cached response content. | |
| void * | data | Test specific data. | |
| MprTestDef * | def | Test definition ref. | |
| MprDispatcher * | dispatcher | Per group thread dispatcher. | |
| int | failedCount | Total failures of this test. | |
| MprList * | failures | List of all failures. | |
| char * | fullName | Fully qualified name of test. | |
| MprList * | groups | List of groups. | |
| int | hasInternet | Convenience flag for internet available for use. | |
| int | hasIPv6 | Convenience flag for IPv6 service. | |
| struct Http * | http | Http service. | |
| MprMutex * | mutex | Multi-thread sync. | |
| char * | name | Name of test. | |
| struct MprTestGroup * | parent | Parent test group. | |
| struct MprTestGroup * | root | Top level test group parent. | |
| MprTestService * | service | Reference to the service. | |
| bool | skip | Skip this test. | |
| bool | skipWarned | Warned that test will be skipped. | |
| bool | success | Result of last run. | |
| int | testComplete | Test complete signal. | |
| int | testCount | Count of tests. | |
| int | testDepth | Depth at which test should run. |
Thread local data storage.
| pthread_key_t | key | Data key. |
Thread service.
| struct MprThread * | eventsThread | Event service thread. | |
| struct MprThread * | mainThread | Main application thread. | |
| MprCond * | pauseThreads | Waiting for threads to yield. | |
| ssize | stackSize | Default thread stack size. | |
| MprList * | threads | List of all threads. |
Wait Service.
Worker Thread Service.
| MprList * | busyThreads | List of threads to service tasks. | |
| MprList * | idleThreads | List of threads to service tasks. | |
| int | maxThreads | Max # threads in worker pool. | |
| int | maxUsedThreads | Max threads ever used. | |
| int | minThreads | Max # threads in worker pool. | |
| MprMutex * | mutex | Per task synchronization. | |
| int | nextThreadNum | Unique next thread number. | |
| int | numThreads | Current number of threads in worker pool. | |
| struct MprEvent * | pruneTimer | Timer for excess threads pruner. | |
| ssize | stackSize | Stack size for worker threads. | |
| MprWorkerProc | startWorker | Worker thread startup hook. |
Statistics for Workers.
| int | busy | Number of busy workers. | |
| int | idle | Number of idle workers. | |
| int | max | Configured max number of workers. | |
| int | maxUsed | Max number of workers ever used used. | |
| int | min | Configured minimum number of workers. | |
| int | yielded | Number of busy workers yielded for GC. |